Reputation: 161
The structure looks like this:
html
->index.html
->subfolder
--->1.html
--->2.html
I want to prevent direct access when someone visits mysite.com/subfolder. The user should instead be directly redirected to the index.html on the parent folder.
How is this possible with .htaccess?
Upvotes: 1
Views: 844
Reputation: 41249
Create an htaccess file in the subfolder and add the following :
RewriteEngine on
RewriteRule ^$ /index.html [L,R]
Remove the R flag if want to internally redirect (without changing the url) /subfolder to /index.html .
Upvotes: 1
Reputation: 223
Is this working out for you?
RewriteRule ^/subfolder/?$ http://yourdomain.com/index.html [R=301,L]
Upvotes: 0