Earlier i have installed my code in the main domain itself. for instance,
http://www.abcd.com/xyz/page.html
there are about 300 pages indexed by google with the old URL.
Now i have removed that code from the main domain and installed the code in Sub-Domain. So it make all the URLs indexed by Google and all the backlinks are pointing to the old URL.
Now i need to point all the old invalid URL to new Valid URL when Users clicks on the old URL.
Please suggest how to handle this.
Thanks a lot…
If you are using Apache, I suggest that you use
mod_rewriteas it allows to send the HTTP status301 Moved Permanently, informing search engines that the contents of your website has been moved to a new location (rather than just deleted).In a .htaccess file:
The first line enables URL “rewriting”, the fancy term for redirections of all kind. The second line is decomposed like this:
RewriteRuleis the directive to match URLs and change the place they point to;(.*)is a regular expression matching any requested file path (without an initial slash)http://newdomain.mysite.com/$1is the place where you want to send your visitors, and$1is expanded to the previously matched path[R=301,L]tells Apache to send the301 Moved PermanentlyHTTP status code, and that it’s the lastRewriteRulethat can match this request (it’s useful only when you have multipleRewriteRules but it doesn’t hurt to have it anyways).The next time crawlers visit your site, they will notice the HTTP status and update their links to your new address. You should have it set up as soon as possible before Google thinks your whole site went 404.