Redirect a temporary IP
-
I was performing some development work on a client's site recently under a temporary location on the host's server, for example:
Google managed to index a couple of pages using this url
I have updated DNS to the correct domain and the site is live, but I am a bit confused in regards to the correct way to create a 301 Redirect for this example or at least a way point it to our 404 page.
I am hoping someone more proficient with htaccess can help me out a bit...
Thanks!
-
Ah, simple, nice work!
-
It was not a "test" server; rather, a temporary url (prior to updating DNS) to the actual client account on the host server. All development pages were deleted, which is why I was looking for a method to accomplish this via htaccess, but it's not looking promising...
UPDATE
I discovered I only needed to remove the numerical portion of the IP address and then form like a normal 301 Redirect.
Example:
Redirect 301 /~accountname/folder/page.html /folder/page/html
As usual, I was over-complicating things
Hope this helps someone. And, thanks for your suggestions Aran.
-
Hi,
On the page (on the test server), you could use the following code (assuming your using PHP).
**header("HTTP/1.1 301 Moved Permanently");
header("Location: client-site.com/new-page-name.html**");**
?>
Hope that helps**
-
Sure! I would like to redirect the temporary url Google indexed (with the server IP in it above) to the correct page name on the now live domain.
For example: client-site.com/new-page-name.html
I am quite familiar with 301's which direct to a new page location/name - however, the IP address and the fact that it's not actually a domain is tripping me up a bit.
Thanks!
-
hi Could you elaborate and explain what is is your want to achieve with the redirect?
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Redirect old image that has backlinks
Hi Moz Community! I'm doing an audit of a website and did a backlink analysis. In the backlink analysis, there is an image that has 66 backlinks but the image doesn't exist on the website anymore (it was on a website that was created in 2011 - 2 web launches ago). I don't believe a 301 redirect will work for an image that doesn't exist anymore. How would I redirect the image URL (it's WordPress so we have a specific URL that other websites are linking to but get 404 errors) without going to each individual website and requesting they change the URL link? Any advice or recommendations would be great. Thanks!
Intermediate & Advanced SEO | | BradChandler1 -
Redirect Issue in .htaccess
Hi, I'm stumped on this, so I'm hoping someone can help. I have a Wordpress site that I migrated to https about a year ago. Shortly after I added some code to my .htaccess file. My intention was to force https and www to all pages. I did see a moderate decline in rankings around the same time, so I feel the code may be wrong. Also, when I run the domain through Open Site Explorer all of the internal links are showing 301 redirects. The code I'm using is below. Thank you in advance for your help! Redirect HTTP to HTTPS RewriteEngine On ensure www. RewriteCond %{HTTP_HOST} !^www. [NC]
Intermediate & Advanced SEO | | JohnWeb12
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ensure https RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 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 USER IP BANNING <limit get="" post="">order allow,deny
deny from 213.238.175.29
deny from 66.249.69.54
allow from all</limit> #Enable gzip compression
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript #Setting heading expires
<ifmodule mod_expires.c="">ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/x-ico "access plus 1 year"
ExpiresByType image/jpg "access plus 14 days"
ExpiresByType image/jpeg "access plus 14 days"
ExpiresByType image/gif "access plus 14 days"
ExpiresByType image/png "access plus 14 days"
ExpiresByType text/css "access plus 14 days"</ifmodule>0 -
Multiple 301 Redirect Query
Hello all, I have 2 301 redirects on my some of my landing pages and wondering if this will cause me serious issues. I first did 301 directs across the whole website as we redid our url structure a couple of months ago. We also has location specific landing pages on our categories but due to thin/duplicate content , we have got rid of these by doing 301's back to the main category pages. We do have physical branches at these locations but given that we didnt get much traffic for those specific categories at those locations and the fact that we cannot write thousands of pages of unique content content , we did 301's. Is this going to cause me issues. I would have thought that 301's drop out of serps ? so is this is an issue than it would only be a temporary one ?.. Or should I have 404'd the location category pages instead. Any advice greatly appreciated. thanks Peter
Intermediate & Advanced SEO | | PeteC120 -
301 redirect with /? in URL
For a Wordpress site that has the ending / in the URL with a ? after it... how can you do a 301 redirect to strip off anything after the / For example how to take this URL domain.com/article-name/?utm_source=feedburner and 301 to this URL domain.com/article-name/ Thank you for the help
Intermediate & Advanced SEO | | COEDMediaGroup0 -
Redirection to mobile site
Calling all SEO ninjas! I'm currently developing single web pages for various clients which function as abbreviated versions of their main websites. They are all related & under a single domain. When a user visits these pages on a mobile device, CSS is used to display mobile friendly versions of these pages. My clients are thrilled with these mobile versions and now want to also redirect mobile visitors from their main site (which is not mobile optimised) to these pages. My questions are: Are there any negative implications if we did this? ie. redirecting to a different domain What is the best method for redirection? eg. JavaScript Can this be achieved by adding a single line of code to their main site Can this be done in an SEO friendly way so that the redirection acts like a backlink? Many thanks.
Intermediate & Advanced SEO | | martyc0 -
301 Redirect question
Which is the best way to set up the 301 redirect on my main home page? http://horsebuggy.com to http://www.horsebuggy.com Or does it make a difference? Boodreaux
Intermediate & Advanced SEO | | Boodreaux0 -
GeoIP - Redirect all but target country
My client would like to redirect all non UK traffic from their UK site to their main group site. I am intending to use a .htaccess redirect, like this: RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^GB$
Intermediate & Advanced SEO | | cottamg
RewriteRule ^(.*)$ http://www.group.com$1 [R,L] I have tested the redirect at it works fine. My question is if I put this in place would it have any negative SEO impact on the UK site?0 -
Unique Ip Hosting Question
We have aged domains that have had unique ips for some time. Batch 1 average 2 years old and are in 1st to 5th place in their rankings. Batch 2 are 8 months old and not ranking at all. Will there be any issues associated with moving them all to a reseller account with a single ip address? In addition batch 1 that has good rankings with unique ips is there ever a possibility they will change our ips without notice or for any reason at all that will change and or fluctuate our rankings?
Intermediate & Advanced SEO | | shandaman0