htaccess: how to prevent infinite subdirectories?
- by Vincent Isles
My .htaccess at the root directory contains this:
Options -MultiViews +FollowSymlinks -Indexes
ErrorDocument 404 /404.htm
RewriteEngine On
RewriteBase /
followed by a bunch of RewriteRules. The .htaccess at the /forum subdirectory contains this:
RewriteEngine On
RewriteBase /forum
RewriteRule ^index.html$ index.php [L,NE]
RewriteRule ^(.*)-t-([0-9]+).html(.*)$ showthread.php?tid=$2$3 [QSA,L]
RewriteRule ^(.*)-t-([0-9]+)-([0-9]+).html$ showthread.php?tid=$2&page=$3 [QSA,L]
followed by other rules mapping SEO-friendly URLs to the true URLs.
mydomain.com/forum/a-thread-t-1.html returns the page showthread.php?tid=1 but so does mydomain.com/forum/forum/a-thread-t-1.html, mydomain.com/forum/forum/forum/a-thread-t-1.html and so on. I don't want this behavior - I want pages accessed as /forum/forum/* to return a 404.
Any hint on where I had been wrong?