phplacky Posted April 2, 2010 Share Posted April 2, 2010 I am transferring servers, but keeping my domain name. How can I effectively use a 301 redirect to capture all those old pages to send to my new home? I read many articels about how to do it, such as http://www.tamingthebeast.net/articles3/spiders-301-redirect.htm stating to simply input redirect 301 /old/old.htm http://www.you.com/new.htm into your .htaccess file But what I don't understand is: * The code " redirect 301 /old/old.htm http://www.you.com/new.htm " appears to be a direct file or folder location. If it will be my entire old server, do I have to add every page that will trigger this error? Or is there an easier way to say anytime it is triggered, just send "here"? * Will this work if the .htaccess file is on only my new server? I am concerned it may not capture the errors if it is on my old server, even though the "address" will still remain the same. I'm new to this. Though it is a bit off topic of PHP, I hope it is elementary enough that anyone can offer me the advice I need! Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/ Share on other sites More sharing options...
trq Posted April 2, 2010 Share Posted April 2, 2010 I am transferring servers, but keeping my domain name. So why would you be needing to redirect anything? Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035620 Share on other sites More sharing options...
phplacky Posted April 2, 2010 Author Share Posted April 2, 2010 Well, I have a site with high search engine rankings. It has goggle indexed pages that will no longer exist. The presence of "page not found" will create 404 errors that will lose those valueable rankings. If I replace it with a 301 redirect the robots will register it as a page found, and keep the site's rankings. As explained in: http://www.tamingthebeast.net/articles3/spiders-301-redirect.htm Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035624 Share on other sites More sharing options...
trq Posted April 2, 2010 Share Posted April 2, 2010 I'm still lost, are you not simply moving your site from one server to another? Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035626 Share on other sites More sharing options...
phplacky Posted April 2, 2010 Author Share Posted April 2, 2010 Scenario: Google presents links via search engine "Best cupcakes in town (link: www.bestcupcakesintown.com/aboutus.htm)" However, upon upgrading site and transferring servers that page link has been changed to www.bestcupcakesintown.com/about.htm, for simplicity. That link on google, when clicked, now doesn't exist. It will give anyone a 404 error. As describe on the site I referenced in my prior post, the the page states: "Search engines have indexed your entire site and pages you're going to move or rename rank well. By altering these files, you run the risk of losing a lot of traffic and leaving visitors to your site who follow a search engine link with the dreaded "Error 404 - File not found". A 301 redirect is the best way to go and I go into some detail on how to implement one in this tutorial, but first let's take a look at a couple of other strategies I often see mentioned around the web to get around the problem and why you shouldn't use them." Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035628 Share on other sites More sharing options...
trq Posted April 2, 2010 Share Posted April 2, 2010 1) If you want to redirect users from the old file location to the new one, these will need to be done individually. Otherwise, you could put a catch all in place that will redirect any request for a non existent file to a (single) file. 2) As long as your domain points to your new server, the old server will no longer get requests fro that domain. Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035631 Share on other sites More sharing options...
phplacky Posted April 2, 2010 Author Share Posted April 2, 2010 That doesn't help me at all. I am aware that the old server will not get requests if the nameserver points to your new one. And, the whole thread was directed towards asking how I catch all 301 redirect for all old page links being accessed on my new server, if it is possible. If you know how to solve this issue, please, let me know. I'm all ears Otherwise...... anyone else want to give it a stab? Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035647 Share on other sites More sharing options...
trq Posted April 2, 2010 Share Posted April 2, 2010 RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /pagetorediretcto.php [R=301,L] Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035651 Share on other sites More sharing options...
phplacky Posted April 2, 2010 Author Share Posted April 2, 2010 Will try that. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/197310-301-redriect-question/#findComment-1035713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.