Automatically redirect 404 to home
This is an open discussion with 5 replies, filed under Troubleshooting.
Search
Not tested, but something like this should work:
RewriteRule ^(.*).html$ / [R=301,L]
To include the trailing slash, shouldn't that be:
RewriteRule ^(.*).html/$ / [R=301,L]
To include the trailing slash, shouldn't that be:
You don't have a trailing slash after files (like .html).
The slash in my example is actually the target (root).
^(.*).html$
rewrites to /
I think in this case having the trailing slash after the filename in external links to the site is Vandenberg's problem.
Thanks, very educational. I ended up having to use both.
Much obliged.
Create an account or sign in to comment.
Hi,
I've redesigned a website with symphony, I've run into a problem with google search results and other websites linking to non existing locations. For example, www.mypage.com/contact.html/
Is it somehow possible to add a line to .htacces that automatically redirects pages that end with .html/ to the home page?
Thanks!