|
||||
|
|
Saturday, January 08, 2005310 Redirect for Search Engines and Changed URLs
Say you have some pages indexed in search engines, but you want to change the URL of those pages. What you should not do:
What you want to do is 1) automatically jump users to the new URLs when they visit the old URLs, and 2) tell search engines that your pages are still good, but they just have a new URLs. You accomplish this with a HTTP 301 Redirect : Moved Permanently". And the code is simple...put this code in your old URLs. ASP: Response.Status = "301 Moved Permanently" ASP.NET: Response.Status = "301 Moved Permanently"; Linux/Unix Apache, in your .htaccess file, put redirect 301 /oldurl.html http://www.domain.com/newurl.html
view current posts
Comments:
Thank you so much for your suggestion, which is exactly what I have been looking for. Could you please elaborate more?
I have a site www.orientalpearls.net, I used to use static page, even though it shows as asp. Then my contracted web developer put them into a php database, it's easier for me now, but the problem is people still find me from my asp page. So could you please tell me what I should do in more detail? copy your code for ASP or create .htaccess file. (do I have to create the file for each page? i.e. www.orientalpearls.net/pearl_earrings.asp)Thank you very much! Also my email is lan@orientalpearls.net. I appreciate very much for your help since I am not that sophiscated in this.
Hi -
Post a Comment
You need to put the 301 redirect code into the OLD pages, and have it point to the NEW pages. For example, assume your OLD page is www.orientalpearls.net/pearl_earrings.asp and your NEW page is http://www.orientalpearls.net/pearl_earrings.php. Then at the top of pearl_earrings.asp, put the ASP 301 redirect code like this Response.Status = "301 Moved Permanently" Response.AddHeader "Location", "http://www.orientalpearls.net/pearl_earrings.php" You will need to have the 301 redirect code in all of your ASP pages. If all your new pages are the same file as the new pages, but with PHP extensions, you might be able to do something fancy like Response.Status = "301 Moved Permanently" Response.AddHeader "Location", "http://www.orientalpearls.net" & Replace(Request.ServerVariables("PATH_INFO"),".asp",".php") inside all your ASP files (or inside an include file that they all use). Let me know how that works out! Ben Archives September 2004 October 2004 November 2004 December 2004 January 2005 February 2005 March 2005 April 2005 |
|||
| ||||