.htaccess ModReWrite Help
I am having problems with the ReWrite code. Please note that the .htaccess file is located in the subdomain folder (... public_html / subdomain /)
I'm just trying to rewrite the 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?
0
a source to share
3 answers
If you want to use rules in the .htaccess file, you need to remove the prefix of the context directory path from the template RewriteRule
. If the .htaccess file is in the document root /
, you need to remove the presenter /
.
Also, you need to quantify the character set. Otherwise, it will only describe one character.
So try this rule:
RewriteRule ^([A-Za-z0-9-_]+)$ index.php?page=$1
+2
a source to share