Forum Moderators: Robert Charlton & goodroi
[edited by: brotherhood_of_LAN at 6:00 am (utc) on Jan 24, 2014]
[edit reason] example.com [/edit]
[edited by: Robert_Charlton at 7:46 am (utc) on Jan 24, 2014]
[edit reason] changed to example.com to disable auto-linking [/edit]
[edited by: Robert_Charlton at 7:35 am (utc) on Jan 24, 2014]
[edit reason] changed to example.com to disable auto-linking [/edit]
Any reason why this code was there?
RewriteCond %{HTTP_HOST} !^(example\.com)?$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
[edited by: aakk9999 at 12:06 pm (utc) on Jan 24, 2014]
[edit reason] Fixed typo on poster's request [/edit]
[edited by: aakk9999 at 4:26 am (utc) on Jan 26, 2014]
[edit reason] Unlinked URL [/edit]
but still gets a 301 error (Moved permanently).
This seems to work fine with example.com, but with www.example.com, GWT crawler says "301" moved permanently to example.com
GWT says:
The page seems to redirect to itself. This may result in an infinite redirect loop
Don't set a preferred domain
Display URLs as www.example.com
Display URLs as example.com RewriteCond %{HTTP_HOST} !^(example\.com)?$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]