Howto: mod_rewrite directory exclusion
Posted: Tue Jul 04, 2006 1:34 pm
(Posting this here for future reference and in case it helps anyone else).
My shared host has a standard redirect for all domains to /stats
Unfortunately the standard mod_rewrite rules in the CMSMS .htaccess file conflicted with this and trying to view /stats took me to the CMS' 404 page.
To fix this I added 3 lines to .htaccess like this:
This is for Dreamhost, I think other shared hosts may need different solutions, but if you have the same problem, this'd be worth a try. See Dreamhost's mod_rewrite wiki page for more info.
Cheers,
C*
P.S. I should probably put the phrase pretty URLs in here too in case someone's searching by that...
My shared host has a standard redirect for all domains to /stats
Unfortunately the standard mod_rewrite rules in the CMSMS .htaccess file conflicted with this and trying to view /stats took me to the CMS' 404 page.
To fix this I added 3 lines to .htaccess like this:
Before:
Code: Select all
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)\.html$ /index.php?page=$1 [QSA]
After:
Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)\.html$ /index.php?page=$1 [QSA]
Cheers,
C*
P.S. I should probably put the phrase pretty URLs in here too in case someone's searching by that...