.htaccess - IP Canonicalization (WordPress) -


when run seo site checkup on site get:

ip canonicalization test: site's ip not redirect site's domain name. cause duplicate content problems if search engine indexes site under both ip , domain name.

i'm running apache, , advice add following .htaccess file:

rewritecond %{http_host} ^xxx\.xxx\.xxx\.xxx rewriterule (.*) http://www.yourdomain.com/$1 [r=301,l] 

using this test, found site has 2 ip addresses, i've added 2 rules in rewrite engine section. website still fails test.

am doing right? here's .htaccess file:

# begin w3tc browser cache <ifmodule mod_deflate.c>     <ifmodule mod_headers.c>         header append vary user-agent env=!dont-vary     </ifmodule>         addoutputfilterbytype deflate text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json     <ifmodule mod_mime.c>         # deflate extension         addoutputfilter deflate js css htm html xml     </ifmodule> </ifmodule> # end w3tc browser cache # begin w3tc page cache core <ifmodule mod_rewrite.c>     rewriteengine on     rewritebase /     rewritecond %{http:accept-encoding} gzip     rewriterule .* - [e=w3tc_enc:_gzip]     rewritecond %{http_cookie} w3tc_preview [nc]     rewriterule .* - [e=w3tc_preview:_preview]     rewritecond %{request_method} !=post     rewritecond %{query_string} =""     rewritecond %{request_uri} \/$     rewritecond %{http_cookie} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [nc]     rewritecond "%{document_root}/wp-content/cache/page_enhanced/%{http_host}/%{request_uri}/_index%{env:w3tc_preview}.html%{env:w3tc_enc}" -f     rewriterule .* "/wp-content/cache/page_enhanced/%{http_host}/%{request_uri}/_index%{env:w3tc_preview}.html%{env:w3tc_enc}" [l] </ifmodule> # end w3tc page cache core # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] rewritecond %{http_host} ^104\.24\.122\.248 rewriterule (.*) http://www.londoncitymedia.com/$1 [r=301,l] rewritecond %{http_host} ^104\.24\.123\.248 rewriterule (.*) http://www.londoncitymedia.com/$1 [r=301,l] </ifmodule>  # end wordpress 

thanks

you need put lines before wordpress dispatcher:

# begin redirect ip domain name <ifmodule mod_rewrite.c>     rewritecond %{http_host} ^104\.24\.122\.248 [or]     rewritecond %{http_host} ^104\.24\.123\.248     rewriterule (.*) http://www.londoncitymedia.com/$1 [r=301,l] </ifmodule> # end redirect ip domain name  # begin w3tc browser cache <ifmodule mod_deflate.c>     <ifmodule mod_headers.c>         header append vary user-agent env=!dont-vary     </ifmodule>         addoutputfilterbytype deflate text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json     <ifmodule mod_mime.c>         # deflate extension         addoutputfilter deflate js css htm html xml     </ifmodule> </ifmodule> # end w3tc browser cache  # begin w3tc page cache core <ifmodule mod_rewrite.c>     rewriteengine on     rewritebase /     rewritecond %{http:accept-encoding} gzip     rewriterule .* - [e=w3tc_enc:_gzip]     rewritecond %{http_cookie} w3tc_preview [nc]     rewriterule .* - [e=w3tc_preview:_preview]     rewritecond %{request_method} !=post     rewritecond %{query_string} =""     rewritecond %{request_uri} \/$     rewritecond %{http_cookie} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [nc]     rewritecond "%{document_root}/wp-content/cache/page_enhanced/%{http_host}/%{request_uri}/_index%{env:w3tc_preview}.html%{env:w3tc_enc}" -f     rewriterule .* "/wp-content/cache/page_enhanced/%{http_host}/%{request_uri}/_index%{env:w3tc_preview}.html%{env:w3tc_enc}" [l] </ifmodule> # end w3tc page cache core  # begin wordpress <ifmodule mod_rewrite.c>     rewriteengine on     rewritebase /     rewriterule ^index\.php$ - [l]     rewritecond %{request_filename} !-f     rewritecond %{request_filename} !-d     rewriterule . /index.php [l] </ifmodule> # end wordpress 

Comments