Hello, today I made some changes to my site, there are ~1000 links which are changed from photo_galery.php?album=3 ... and photo_pop.php?photo=980 to /photo-gallery/my-album-name/3/ and /foto/photo-name/980/ What is the better way to make google spider my new files and forget about the old files ? Should I ad in the old files the field <META name="Robots" content="noindex,follow"> Should I make an redirect header("Location:/new-path-to-files/"); ? ( do I need to add another header before Location:... ? ) Which is the best way ? or other better alternatives ? 10x in advance Bye
If you are on an Apache server, insert a 301 permanent redirect statement into the .htacess file. See the DigitalPoint Apache forum for instructions on how to do this. Note that most people will tell you you need to use mod_rewrite to do this, which is incorrect. It may be the most efficient since you can use wildcards but you may not be able to use mod_rewrite on some server configurations. If so, you can use the following: Redirect 301 /oldpage.html http://www.domainname.com/newpage.html Code (markup): for each page that has changed. If you cannot use .htaccess, there are other ways to do a permanent redirect. For example you can use PHP or ASP if your server supports either of those: For PHP: <?PHP header("HTTP/1.1 301 Moved Permanently"); header ('Location: http://www.newsite.com/newpage.html'); exit (); ?> Code (markup): For ASP: <% response.Status = "301 Moved Permanently" response.addheader "location", "http://www.newdomain.com/page.html" response.end %> Code (markup): Or you can use the meta-refresh: <HTML> <HEAD> <META HTTP-EQUIV="REFRESH" CONTENT="10; URL=http://www.yourdomain.com/newpage.html"></head> Code (markup):
From the format of your new URLs it looks like you're using mod_rewrite already. If that's the case, you may be able to redirect the current URLs by adding an [L] flag to your existing RewriteRules to tell the server that this the last rule which should be obeyed and it should stop rewriting now, and then add in some RewriteCond / RewriteRule pairs to handle changing the old style urls to the new style.
[quote-johnt]From the format of your new URLs it looks like you're using mod_rewrite already.[/quote] Doh! I think it's probably safe to say that... need more coffee But still, the post does point out that there is more than one way to skin that cat too
10x for your alternatives I think I will use <?PHP header("HTTP/1.1 301 Moved Permanently"); header ('Location: http://www.newsite.com/newpage.html'); exit (); ?> in my case this is the easiest and fastest way to do it .. and if it's ok for google I'm Happy with it. I just need to edit 2 files . that's all .
only put this code in .htaccess file redirect 301 http://abc.com http://xyz.com http://abc.com is old url http://xyz.com is new url so, old url will be change into new rul of a site. if i want to change all pages of http://xyz.com then what have to do? kindly explain that how to put which one code in .htaccess file