Reputation: 399
I've used mod_rewrite to create cleaner URLs for a site located in my document root directory. On moving the site to a subdirectory, the URLs no longer work. How can I alter where the module view the document root in the subdirectory's .htaccess.
If possible, I'd rather not create another .htaccess in the document root or add /subdirectory for each rewrite. I've tried RewriteBase /sub
but this doesn't seem to come to anything. Any ideas?
.htaccess
RewriteEngine On
RewriteRule ^contact$ /contact.html [L]
RewriteRule ^about$ /about.html [L]
RewriteRule ^britishprojects$ /british.html [L]
RewriteRule ^otherprojects$ /european.html [L]
RewriteRule ^video$ /media.html [L]
structure
- /
- /sub
- .htaccess
- index.html etc.
Upvotes: 0
Views: 50
Reputation: 17872
Rewritebase only works when the substitution parameter is relative. Remove your leading slash on the second arg of RewriteRule.
Upvotes: 1