Reputation: 2194
Given urls like this:
mysite.com/index.php
mysite.com/page/member/lobby.php
mysite.com/page/videos/video1.php
How can I rewrite the urls with .htaccess to hide the /page/ folder when it's present?
So the end result is:
mysite.com/index.php
mysite.com/member/lobby.php
mysite.com/videos/video1.php
Upvotes: 0
Views: 74
Reputation: 655239
You can use this rule to add page/
to your path internally:
RewriteCond $1 !=page
RewriteRule ^([^/]+)/.+ page/$0 [L]
Now every request that’s URI path has at least two path segments but that’s first segment is not page
will be prefixes with /page
. So /member/lobby.php
will be rewritten to /page/member/lobby.php
.
Upvotes: 1