Hi all. I've been trying to set up a .htaccess file today in order to do the following:
1) Link to my custom 404 page
2) Stop people hotlinking
3) Redirect non-www requests to the www equivalent
4) Redirect /index.html requests to the root
1, 2 and 3 were fine. 4 isn't working for some reason, and I can't figure out why. Can anyone have a quick look at my code and see if i'm making any stupid mistakes? I'm a bit of a noob so hopefully its glaringly obvious.
My .htaccess file is:
Any help would be much appreciated.
Thanks
1) Link to my custom 404 page
2) Stop people hotlinking
3) Redirect non-www requests to the www equivalent
4) Redirect /index.html requests to the root
1, 2 and 3 were fine. 4 isn't working for some reason, and I can't figure out why. Can anyone have a quick look at my code and see if i'm making any stupid mistakes? I'm a bit of a noob so hopefully its glaringly obvious.
My .htaccess file is:
and the file is placed in the same location as my index.html file.Options +FollowSymlinks
#1
ErrorDocument 404 /custom404.html
#2
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?mysite.co.uk/.*$ [NC]
RewriteRule \.(gif|jpe?g|png)$ - [F]
#3
RewriteCond %{HTTP_HOST} !^www.mysite.co.uk$
RewriteRule ^(.*)$ http://www.mysite.co.uk/$1 [R=301]
#4
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html$ http://www.mysite.co.uk/$1 [R=301,L]
Any help would be much appreciated.
Thanks