Building new website on old domain name. How should I redirect the old site? - .htaccess

I recently moved a website to another domain, but I am keeping the original domain for a future website. The recently moved website is permanently moved, but I only want traffic to be redirected temporarily to the other domain.
I have read countless 301 vs 302 posts, articles, etc. and have failed to find any that address this particular situation. And no one answered this similar question:
Moving to a new domain and using the old one for a new website - how to handle 301 redirects?
But the difference with my question is: I don't even know that I should be using a 301 redirect for this. What's the best way to handle this situation in general?

301 Moved Permanently doesn't mean that the domain name should never be used again; it means that the content the user requested has moved permanently, which is exactly the situation you describe.
(308 Permanent Redirect is supposed to supplement 301, but it is sometimes treated oddly and doesn't work at all on Windows 7 or 8.1 under IE.)
When you decide to re-use the old domain for a new set of resources, you can simply stop redirecting away from it. By then you hope that people looking for the old resource have updated their bookmarks/links thanks to the 301. It might be polite to allow some duration of time for this transition to occur.
Neither 302 Found nor its replacement 307 Temporary Redirect is appropriate here, as both misrepresent the situation and do not signify that people should permanently look for the old content in the new location: they're going to be mighty confused when the original domain no longer redirects, allegedly the end of a temporary situation, but then also does not serve the expected content.

You can use the .htaccess file to redirect with 307 status code (the successor of 302 in HTTP/1.1)
Redirect 307 / http://other-domain/

Here's a link that you may find helpful. You can also redirect with 308 status code also as #István Rábel suggested

Related

redirect from old mod-write to new one

So I had a mod re-write all set up for a client who was hosting their site on a shared server with GoDaddy. After nearly of year of working they contacted me and GoDaddy had changed something that made the re-write not work properly. It would work sometimes but not all the time. Anywway, it liked nice URLs such as http://siteurl.com/employee/19/ as opposed to http://siteurl.com/employee-19 from what I was reading it had something to do with it not ending in a slash but either way, the first one works now.
However is there a way to create a redirect from the old modrewrite rule to the new one. I tried this but had never really done rewrites on the htaccess file before so I could have set it up wrong.
redirect /employee-19 http://siteurl.com/employee/19/
But that spits back an error 301, any thoughts on how to fix this or is it just a lost cause at this point?
But that spits back an error 301, any thoughts on how to fix this or is it just a lost cause at this point?
A 301 is what you want. It tells browsers and search engine indexing bots that http://siteurl.com/employee-19 is equivalent to http://siteurl.com/employee/19/ but to use the latter from now on. The content has permanently moved from the first to the second URL.
If you want a more generalized form, you can use RedirectMatch:
RedirectMatch 301 ^/employee-([0-9]+) http://siteurl.com/employee/$1/

301 Redirect from Dynamic to .html. Wants to 404 orginal

I apologize if in the wrong place. I have someone that has done 301 redirects where dynamic pages are being redirected to show .html. (www.printe-z.com/computer-checks to www.printe-z.com/computer-checks.html) They feels they should now use a custom 404 page for the original page(s); www.printe-z.com/computer-checks. What do you think? Leave it the way it is?
301 is better for this scenario, specially for search engines: they will associate your old urls with the new ones so you'll keep your pages rank.
People accessing your old links will be benefited too since they will be automatically redirected to new urls.
If the page has moved use 301. If it is removed all together, 404.
301 tells crawlers such as googlebot that the original page is moved permanently to the target page. So keep it as it is.
For your information, most URL rewritings are done using 301 Permanent Redirects. Also sending domain.com visitors to www.domain.com is an example where 301 redirection is used.
People might have bookmarked the old urls, or there may be a link on a website to the old url. Unless you are sure this is no longer the case, which you never can, you can remove the 301. But this is in a perfect world.
If the 301's are a maintenance burden, or have some other negative side-effect and the 301 have been there for some time ( >1 year), you could just remove them. But if not just leave them be.

Htaccess.. changing the domain name

I have a big Joomla website that was moved from .com to .eu domain.
The sites are on one web server.
On the old website there are a lot of links that point directly to oldwebsite.com/somethinghere.
Is there a way with Htaccess file in the old domains folder to redirect
from oldwebsite.com/somethinhere to newwebsite.eu/somethinghere?
Or maybe a way to do this on the new website folder?
Thank you,
Chris.
There are many ways, some people recommend using RewriteEngine, but there is an easier way:
Redirect 301 / http://domain.eu/
This will automatically handle files in the domain -- for example, old.com/foo will be redirected to new.eu/foo
EDIT: Regarding "301", that is the code for a permanent redirect. There also exist temporary redirects (I believe the code is 302), but it sounds like what you need is exactly this - a permanent redirect.
EDIT2: Oh and, I think the / after domain.eu may be required, but I'm not 100% sure - doesn't hurt for it to be there, that's for sure! I know that because I use the same kind of a redirect on a production website.

Migrating a website to a new domain, and associated google index problem

We currently have a website at "somedomain.net/codefest". We do not own this server (or this domain name).
Due to capacity problems, we are now moving to a new server. Since we do not own the old domain name, we are also moving to a new domain name.
Since we'll need to abandon the old server soon, we'll be redirecting all requests to "somedomain.net/codefest/anything" to "newdomain.net/anything".
My problem is, after a lot of effort, our website's page rank is now fairly significant. I'm sure moving our website to a new domain name will be drastically detrimental to our website's search engine rank.
Is there any way we can tell the search bots that we've moved the website? Perhaps, when I redirect from the old site, if I give a 302 redirect, search spiders will notice it?
Is there any other issue related to moving our website that I should be aware of?
Thanks,
jrh
Google recommend a 301 redirect. (301 indicates permanent change. 302 indicates a temporary change.)
They have other advice on their Moving Your Site FAQ page which should be more widely applicable than just Google.

bots and 301 redirect

I have changed the structure of the URLs of my site more than 6 months ago. I detect the use of legacy URLs and redirect to the new URL with a 301 status code. I verified with flidder that the status code is correctly returned upon the request. But bots (yahoo slurps, googlebot, etc.) are still hitting the old URLs. Is there something I am missing?
No, just it takes a very, very long time for crawlers to get the message. I have bots crawling addresses that have not existed since 2005 - when folk harp on with addresses being permanent, they really are.
Additionally, depending on how your URL's are structured, you can disallow the old addresses with robots.txt
Try this and this will only redirect to the bots.
if (preg_match("#(google|slurp#inktomi|yahoo! slurp|msnbot)#si", $_SERVER['HTTP_USER_AGENT'])) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.your-main-site.com/");
exit;
}
If external sites have linked to your old pages and those links are still accessible for bots, the bots will keep coming and try to access the content.
mentioned you site address here:
http://www.your-main-site.com/
Thats we use to transfer the domain and sometime for blackhat seo.

Resources