deploydeploy
asked on
301 redirect from old site to new site
Hi
I have my site hosted at squarespace.com and now I want to move to a wordpress site instead.
My Squarespace site at lets say oldsite.tv will be moved to newsite.dk
I can't edit .htaccess on the squarespace site. So my plan is to point oldsite.tv to newsite.dk with a cname.
But how do I handle users who find a link in google that points to http://oldsite.tv/guides/how-to-do-this.html so that they receive a 301 permanet redirect to http://newsite.dk/how-to-do-this.html
I guess I need a .htaccess in the root of my new domain, but I can't quite figure out what conditions I have to put in it to make this work.
Cheers
Per
I have my site hosted at squarespace.com and now I want to move to a wordpress site instead.
My Squarespace site at lets say oldsite.tv will be moved to newsite.dk
I can't edit .htaccess on the squarespace site. So my plan is to point oldsite.tv to newsite.dk with a cname.
But how do I handle users who find a link in google that points to http://oldsite.tv/guides/how-to-do-this.html so that they receive a 301 permanet redirect to http://newsite.dk/how-to-do-this.html
I guess I need a .htaccess in the root of my new domain, but I can't quite figure out what conditions I have to put in it to make this work.
Cheers
Per
ASKER
Hi
Thanks for your reply. I'm just not sure thats enough.
So if a user in google finds the link:
http://oldsite.tv/guides/a-page.html
He will go to my new website and the .htaccess file should then make a 301 redirect to http://newsite.dk/a-page.html
Will your:
redirect 301 /guides/a-page.html http://newsite.dk/a-page.html
Do that?
And as a little followup, what if I need 200 pages with the style http://oldsite.tv/guides/blabla.html to be redirected to http://newsite.dk/blabla.html
Cheers
Per
Thanks for your reply. I'm just not sure thats enough.
So if a user in google finds the link:
http://oldsite.tv/guides/a-page.html
He will go to my new website and the .htaccess file should then make a 301 redirect to http://newsite.dk/a-page.html
Will your:
redirect 301 /guides/a-page.html http://newsite.dk/a-page.html
Do that?
And as a little followup, what if I need 200 pages with the style http://oldsite.tv/guides/blabla.html to be redirected to http://newsite.dk/blabla.html
Cheers
Per
I did something like in the code snippet.
You should also register both websites with Google Webmaster Tools and tell them about the change of address. It should help things go more smoothly.
You should also register both websites with Google Webmaster Tools and tell them about the change of address. It should help things go more smoothly.
RewriteCond %{HTTP_HOST} ^.*oldwebsite\.com
RewriteRule ^(.*)$ http://www.newwebsite.com/$1 [R=301,NC,L]
ASKER
Hi
Also nice input but that doesn't quite cut it. As I described above, I also make changes to the url-structure after the domain name.
I go from:
oldsite.tv/GUIDES/some-pag e.html
To:
newsite.dk/some-page.html
Your suggestion would result in:
newsite.dk/GUIDES/some-pag e.html
I need:
newsite.dk/some-page.html
I hope I have made myself clear now.
Cheers
Per
Also nice input but that doesn't quite cut it. As I described above, I also make changes to the url-structure after the domain name.
I go from:
oldsite.tv/GUIDES/some-pag
To:
newsite.dk/some-page.html
Your suggestion would result in:
newsite.dk/GUIDES/some-pag
I need:
newsite.dk/some-page.html
I hope I have made myself clear now.
Cheers
Per
My case was the same. If there is no pattern to the mapping, then you will have to map every URL separately:
# map known URLs
RewriteRule ^GUIDES/some-page.html$ http://newsite.dk/some-page.html [R=301,NC,L]
RewriteRule ^GUIDES/other-page.html$ http://newsite.dk/other-page.html [R=301,NC,L]
# directly map the rest
RewriteCond %{HTTP_HOST} ^.*oldsite\.tv
RewriteRule ^(.*)$ http://newsite.dk/$1 [R=301,NC,L]
ASKER
Well I have a pattern:
/guides/ needs to be stripped away.
I just can't figure out the syntax to doing so.
I have lots of post like this: http://oldsite.com/guides/08/22/2010/apage.html
I want a 301 redirect to http://newsite.dk/apage.html where the word guides and /08/22/2010 are stripped from the url.
Cheers
Per
/guides/ needs to be stripped away.
I just can't figure out the syntax to doing so.
I have lots of post like this: http://oldsite.com/guides/08/22/2010/apage.html
I want a 301 redirect to http://newsite.dk/apage.html where the word guides and /08/22/2010 are stripped from the url.
Cheers
Per
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I think I need another opinion too, because your not quite certain.
Cheers
Per
Cheers
Per
Hi, Tiggerito rule will do what you ask.
Cheers @arober11
redirect 301 /old/old.htm http://www.yoursite.com/new.htm