Reputation: 1920
There are two parts to this problem:
Here is part of my .htaccess that deals with that:
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.+) /$1.php [L]
Here is part of my .htaccess that deals with the issue:
RewriteRule ^register website/register
RewriteRule ^register/rules website/rules
What I am trying to accomplish is this:
http://www.example.com/register uses the rewrite rule to show website/register http://www.example.com/register/rules uses the rewrite rule to show website/rules
The problem is that the URL box shows example.com/register/rules but the page continues to show the content of example.com/register.
What is going wrong here? Is it the ".php" extension is the first part that is causing all this? Or is my htaccess just completely wrong?
Upvotes: 2
Views: 1097
Reputation: 143856
Nothing is happening. The URL box shows example.com/register/rules but the page continues to show the content of example.com/register
This is happening because you aren't bounding the rules, you have this:
RewriteRule ^register website/register
RewriteRule ^register/rules website/rules
The 2nd rule never gets applied because the URI /register/rules
, matches the first rule's regex (^register
, meaning, "the URI starts with register
"). Either add ending boundaries:
RewriteRule ^register/?$ website/register [L]
RewriteRule ^register/rules/?$ website/rules [L]
or swap them around:
RewriteRule ^register/rules website/rules [L]
RewriteRule ^register website/register [L]
Though you will need the [L]
flag.
Upvotes: 1