Mobile app version of vmapp.org
Login or Join
Nimeshi995

: Redirecting IP address to domain address Google has indexed the IP address of my site rather than the domain, so now I'm trying to set up a 301 redirect that will redirect the IP address

@Nimeshi995

Posted in: #301Redirect #Apache #Htaccess #ModRewrite

Google has indexed the IP address of my site rather than the domain, so now I'm trying to set up a 301 redirect that will redirect the IP address and all subsequent pages to the domain.

I currently have something like this in my .htaccess file (however don't think it's working correctly?):

RewriteCond %{HTTP_HOST} ^12.34.567.890
RewriteRule (.*) (domain address)/ [R=301,L]


I've used various redirect checker tools and keep getting the message: "... not redirecting to any URL or the redirect is NOT SEARCH ENGINE FRIENDLY"

Am I doing something wrong or is there something else I should be trying?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi995

2 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

Something like this

RewriteCond %{HTTP_HOST} ^12.34.567.890$
RewriteRule ^(.*)$ example.domain.com/ [R=301,L]


If either the old or new url won't dereference, then usually the Google crawler complains.

10% popularity Vote Up Vote Down


 

@Murphy175

Try this pattern for your httphost cond (the following represent the end of the first line)

!^example.com [NC]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme