I tried to rewrite my URLs so they no longer have the .html
extension. But when I did this (successfully) Google can no longer crawl my pages when I use "Fetch as Google". Instead, it returns 404
errors and says they're unreachable.
This is what I have in my .htacess file:
Options +Includes
AddHandler server-parsed .html
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://www.example.com/$1 [R=301,L]
This works great, and if I type the URL in a browser's address bar it takes me there. However, Google is still returning 404
errors.
I think it has something to do with the above code rewriting it to www.example.com
while Google is requesting http://www.example.com
. I'm not sure how to fix this though.