Forum Moderators: phranque
In the same thread was a recommendation for a command to change html to htm on pages.
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*index(\.[a-z0-9]+)?[^\ ]* generally your directives should go in order of most specific redirects to least specific
[R=permanent] with [R=301,L]
http://example.com/.(html?|htm) should be http://example.com/$1 ^www.example.com [NC] with !^(www\.example\.com)?$ If these three files were in the wrong place so some of the request shouldn't have worked
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^(([^/]+/)*)index\.html http://www.example.com/$1 [R=301,NS,L]
http://example.com/directory/index.html http://www.example.com/directory/index.html http://www.example.com/directory/ So I tried a request in capitals on the newer site and it locked up. It gave a 500 internal server error. Is there a better/easier solution?
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{HTTP_HOST} !^$
# Redirect all WWW to NON WWW
RewriteBase / The INDEX rule seemed to work for a while but it seems to have a problem with capitals. It didn't remove the index.htm page. Instead it put it in capitals.
RewriteRule {blahblah}index\.html? {target here} RewriteRule ({blahblah}\.htm)l {target ending in $1} # 301 permanent redirect index.html(htm) to ONLY the root (not all folders)
RewriteRule ^index.html$ http://example.com/ [R=301,L]
RewriteRule ^index.htm$ http://example.com/ [R=301,L]
RewriteRule ^index\.html?$ http://example.com/ [R=301,L] I wasn't sure what you meant should replace blahblah should be replaced with. What I did might be wrong.
It did not work for Opera. A "moved permanently" came up. There was a link indicating you could go to the new page. There was no new page. This comes up most of the time.
# Redirect all .HTML requests to .htm on canonical host
RewriteRule ^(.*).html$ http://example.com/$1.htm [R=301,L]
# Redirect all WWW to NON WWW
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*) http://example.com/$1 [R=301,L]
This rule seemed to work the best. Opera and FireFox removed the www but Chrome left it there.
I would be willing to give up on the html to htm but think the index.htm to / would be good to consolidate page rank. I occasionally see them both listed in a list of site pages.
RewriteRule ^(([^/]+/)*)index\.html? http://www.example.com/$1 [R=301,L] I removed the html and index.htm from the .haccess file. Now the homepage with index.htm comes up as a 404 page. Is it possible all the old commands are still in the memory? Could it clear up in time?
Bing also presents problems. There are 304 new error pages with 50 some 301 redirects most of which are 404s. HTML does not show up really with this new batch of 404s. There are a few html pages in the 301 file. Mostly the error pages list the domain name/directory 2/directory 4/real directory/real file name.htm. Some errors have more incorrect directories then the example. Bing has taken names of directories that exist on the site and then mixed them in the middle of the real domain/directory1/index.htm or any other correct page address.
Is this possible to fix in the .htaccess file or should I just forget it? I would like to work on getting more pages in Bing.
Bing seems to be the engine that shows a lot of html files.