For IP canonicalization, I’m told I need to redirect the IP address of the site to the domain name. I’m running a standard WordPress install that already comes with it’s own .htaccess file. I modified it below by adding the “Redirect” line:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 301 http://12.34.56.789 http://www.domainname.com
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
However, it’s not working. Anyone know what is wrong?
Thanks!
You generally don’t want to mix
Redirect
(mod_alias) withRewriteRule
(mod_rewrite) because they both get applied to the same URI and will clobber each others changes sometimes. Just stick with mod_rewrite because you have wordpress rules that already use it.Replace the
with:
Jon Lin’s answer worked for me but I had to use
instead of