Forum Moderators: Robert Charlton & goodroi
How do I the search engins to go permanently from: http://www.example.com/content-1232.html
to
http://example.com/content-1232.html
This is my .htaccess
RewriteEngine on
RewriteRule ^content(.*)\.html$ /index.php?id=$1";$htaccessban = "
<Limit GET>
order deny,allow
deny from d.example.com
deny from f.example.com
deny from g.example.com
</Limit>
ErrorDocument 404 /
I tried all the modrewrite codes mentioned in
[webmasterworld.com...] . But nothing worked.
[edited by: ciml at 11:33 am (utc) on July 13, 2005]
[edit reason] Examplified [/edit]
RewriteEngine on
RewriteCond %{HTTP_HOST}!^MyDomain\.com
RewriteRule (.*) [MyDomain.com...] [R=301,L]
This is on Linux/Apache and cPanel's htaccess file.
I would guess someone there would notice the correct rewrite for this:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^MyDomain\.com
RewriteRule (.*) http://MyDomain.com/$1 [R=301,L]
Is actually this:
RewriteEngine on
RewriteCond ${HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^MyDomain\.com
RewriteRule (.*) http://MyDomain.com/$1 [R=301,L]
If the top line, which checks for any single character in the HOST header to indicate that the browser is capable of sending the appropriate header, is not added HTTP 1.0 clients (or others) that do not send HOST headers will get caught in an infinite loop, becuase their HOST will always be !(not) MyDomain.com, as it is empty.
Justin