I'm using mod_rewrite in my .htaccess file to rewrite URLs from this:
http://www.mysite.com/page/section/
To this:
http://www.mysite.com/index.php?page=$1§ion=$2
Using this:
RewriteRule ^([A-Za-z0-9-]+)/?(?
[A-Za-z0-9-]+)/?)*$ /index.php?page=$1§ion=$2 [NC,L]
This mostly works, but I'm seeing strange behavior when the "page" part of the URL is the same as an existing directory of the same name. So for example, if I want a page to load like this:
http://www.mysite.com/video/ to http://www.mysite.com/index.php?page=video§ion=
But also a real directory exists at /video/, then what happens is instead of keeping the "clean" url like I want, it redirects to this:
http://www.mysite.com/video/?page=video§ion=
Is there any way to fix this, besides renaming the "real" directory to something else? I have tried turning off indexes, but that did not work.
http://www.mysite.com/page/section/
To this:
http://www.mysite.com/index.php?page=$1§ion=$2
Using this:
RewriteRule ^([A-Za-z0-9-]+)/?(?
This mostly works, but I'm seeing strange behavior when the "page" part of the URL is the same as an existing directory of the same name. So for example, if I want a page to load like this:
http://www.mysite.com/video/ to http://www.mysite.com/index.php?page=video§ion=
But also a real directory exists at /video/, then what happens is instead of keeping the "clean" url like I want, it redirects to this:
http://www.mysite.com/video/?page=video§ion=
Is there any way to fix this, besides renaming the "real" directory to something else? I have tried turning off indexes, but that did not work.