In my site I have many folders that holds different type of files.
/img/ /js/ /styles/ /files/
(I have 20 more and I will add more eventually)
Currently, I have in each folder a index.html
(my default directory) that has a meta tag redirect to the web root level.
Is there a better method or an easier way to redirect dynamically these folders to the web root without creating a file everytime?
Edit: I am using: CentOS 5.7 + Apache 2 + php 5.3.5 + MySQL 5.1
Thank you
I do not think there's a mod for what you need. Here's what I suggest:
RewriteEngine On RewriteBase / RewriteRule ^(img|js|styles|files)/?$ http://www.domain.com/ [R=301,L]
This way, if someone request http://www.domain.com/img/, he will automatically get redirected to the main page.
OR if you prefer:
RewriteRule ^(img|js)/?$ - [F]
that will give a permission denied.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With