I am having some trouble with my ReWrite code. Please note that the .htaccess file is in the subdomain folder (...public_html/subdomain/ )
I am simply trying to rewrite a page request:
http://subdomain.mysite.com/home
http://subdomain.mysite.com/index.php?page=home
My .htaccess file looks like this...
RewriteEngine On
RewriteRule ^/([A-Za-z0-9\-\_])$ /index.php?page=$1
Does anything jump out at you?
I think
is ok ;)
If you want to use the rules in a .htaccess file, you need to strip the contextual per-directory path prefix from the
RewriteRule
pattern. If the .htaccess file is located in the document root/
, you need to strip the leading/
.Additionally you need to quantify the character set. Otherwise it would only describe one character.
So try this rule:
Your current rule probably works for urls one character long (after the slash)!
Add a
+
to signify one or more characters, or a*
for zero or moreTry