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?
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
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
-
Selectively 301 redirects
Hi there: We are developing a pretty typical 301 redirection strategy. We basically are moving blog posts from a former sub-domain to the top level of our new designed site. We've pulled a site crawl of the old sub-domain and want to make sure we redirect any posts with a significant backlink profile to their current counterparts. Most other posts are just going to be redirected to the main 'front door' of our new blog. Is there a way to selectively redirect a certain number of posts and then 'globally' redirect everything else to a single URL? I would assume this would be a pretty common task, but can't find an easy way to do what we want to do.
Intermediate & Advanced SEO | | Daaveey0 -
Should I redirect off topic blog posts?
We launched a store on top of a popular blog. The blog had nothing to do with the store. The blog has a lot of backlinks and traffic, but our store is now our primary business. I am concerned that the off topic blog content may be affecting or ability to rank better for the core store business. Should we delete or redirect the old blog content to another website to improve the SEO for our store?
Intermediate & Advanced SEO | | seo-mojo1 -
301 redirects
One of our employees took an SEO class recently. She was told that having too many 301 redirects can hurt SEO. I have never heard of 301 redirects as having a negative impact. Any thoughts?
Intermediate & Advanced SEO | | Smart_Start0 -
Should I redirect 404s or should I eliminate them?
Hello! I am now checking a website that has been migrated months ago from osCommerce to Prestashop.
Intermediate & Advanced SEO | | teconsite
While I was checking crawl errors in search console I found a lot of 404s coming from the last website. The urls are mainly 4 types: popup_image.php?pID=125&osCsid=507c27261ba5ca2568f06ce5bad2ebc9 product-friendly-url-pr-125%3FosCsid.... product-friendly-url-p-125%3FosCsid..... products_new.php?page=228 I've have realized that the parameter pId, and the number that comes after pr- and p- is the product Id in the new website, so I think our team will be able to create an script to redirect those. My question is: Is it ok to send several urls to the same url?. I mean, the popup_image.php was not the product page, as its name says it's more like a popup page. We don't have now a pop up page for images, so I was thinking to send that url to the product page. the one with the pr- was product review page the one with the p- was the product page I was thinking on redirecting the 3 of them to the product page? Should I? Or should I just redirect the last one (p-) and eliminate the others from the index? And... the ones with products_new.php?page=228 I was thinking to redirect all to the page 1 of new products. Is it ok? thank you!0 -
Multilingual Redirection
Hey there awesome Mozzers, I have a site that it automatically redirects people by using geolocation ( i know that probably is not good ) to the various languages of the site. I just wanted to know Is 301 or 302 the best option? ( I've heard that for language re-directions 302 is the best case scenario ) My main page for example is www.example.com and it automatically redirects with a 301 to www.example.com/en for any language that is not there. What is the best case scenario? Leave it to redirect to /en or just leave it go to the root page www.example.com.
Intermediate & Advanced SEO | | Angelos_Savvaidis0 -
Help needed regarding 1:1 Redirection
Hi all, We are currently working on a very large site having approximately 5000+ pages and its going to be 301 redirected to a new domain. For this we need to redirect each and every page on a 1:1 basis as mentioned in the Webmaster Central guide. Now the site is in flt file and not in CMS and is becoming very tough to set manually redirection for these pages. The site is hosted in a Windows server and using IIS web config file. Now any help regarding any automated or easy way to do the 1:1 redirection will be appreciated. Thanks in advance,
Intermediate & Advanced SEO | | ITRIX0 -
Question about 301 redirect for trailing / ?
I am cleaning up a fairly large site. Some pages have a trailing slash on the end some don't. Some of the existing backlinks built used a trailing slash in the url and some didn't. We aren't concerned with picking a particular one but just want to get one set and stick to it from now on. I am wondering, would I clean this up within the same redirect in the htaccess file that takes care of the www and non www? example RewriteEngine On
Intermediate & Advanced SEO | | PEnterprises
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301] I currently use that to redirect the www. to the non www as you can see. However here is what I was confused about. Would this code be enough to redirect ALL pages with a / to the ones without? or would I also need to add another code (so there is 2) to my htaccess like below? RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301] RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301] That way, now, even the non www pages with a trailing slash will redirect to the non www without the trailing slash. Hopefully you understand what I am getting at. I just want to redirect EVERYTHING to the non www WITHOUT a / Thank you Jake0 -
Regarding 301 Redirect!
Hello, I heard that 301 redirect can be good for newly registered domain names can i buy a old domain name and put 301 redirect on it to my newly registered niche market domain name. Shall i buy only 1 domain name and put 301 redirect to my newly registered domain names or i can do this for more than 1 old domains i purchased?
Intermediate & Advanced SEO | | anand20100