I have a site with only 2 sub pages that i want to keep, i want to redirect all other sub pages to homepage. This is my current htaccess code:
# this is to disable varnish caching on my server
Header set Set-Cookie "_asomcnc=1; max-age=900; path=/;"
RewriteEngine On
# redirect to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# redirect index.html to root
RewriteBase /
RewriteRule ^index\.html$ / [NC,R,L]
# remove trailing slash
RewriteRule ^(.*)/$ /$1 [L,R=301]
I tried few examples i found here on stack overflow but i keep getting redirect loops, or my css file and images are not loaded. So lets say i want to load all files from these two folders:
- /css
- /images
And also i want to keep 2 subpages:
- /subpage1.html
- /subpage2.html
Everything else should be redirected to homepage.