Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




791 posts

Ultimate Geek
+1 received by user: 79

Trusted

Topic # 133402 21-Oct-2013 12:02
Send private message

Does anyone know the code for a full 301 redirect?

eg. olddomain.com/*  ( all pages) redirect to newdomain.com with different content.




Create new topic
2358 posts

Uber Geek
+1 received by user: 378

Trusted

  Reply # 919095 21-Oct-2013 12:19
Send private message

http://www.howto301redirect.com/htaccess-redirect/





791 posts

Ultimate Geek
+1 received by user: 79

Trusted

  Reply # 919101 21-Oct-2013 12:29
Send private message

LennonNZ: http://www.howto301redirect.com/htaccess-redirect/




Thanks, tried the "moved entire site"
when i type olddomain.com/randompage, i get taken to newdomain.com/randompage  and get a "404 error, page not found"
All link structures are different, content is different on both sites.

i just need all the pages/links in olddomain.com redirected to newdomain.com homepage.





 
 
 
 


1314 posts

Uber Geek
+1 received by user: 153


  Reply # 919114 21-Oct-2013 12:34
Send private message

Are you trying to 'forward' to the new sites landing page, or 'redirect' to the site at its new location (including same content)?





Software Engineer

 




791 posts

Ultimate Geek
+1 received by user: 79

Trusted

  Reply # 919117 21-Oct-2013 12:37
Send private message

TwoSeven: Are you trying to 'forward' to the new sites landing page, or 'redirect' to the site at its new location (including same content)?



Company 1 has taken over company 2.
im trying to redirect any link/url from oldcompany.com to newcompany.com, with 301 and still keeping the backlinks of oldcompany.com.

oldcompany.com has now closed so im looking to hold onto their backlinks and traffic




2531 posts

Uber Geek
+1 received by user: 940

Subscriber

  Reply # 919135 21-Oct-2013 13:00
Send private message

If it's hosted on apache you could simply use mod rewrite to rewrite any url with oldcompany.com in it to newcompany.com's default page.

[code]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.oldcompany.com$ [OR]
RewriteCond %{HTTP_HOST} ^oldcompany.com$
RewriteRule ^(.*)$ http://www.newcompany.com/ [R=301,L]
[/code]



791 posts

Ultimate Geek
+1 received by user: 79

Trusted

  Reply # 919156 21-Oct-2013 13:08
Send private message

Inphinity: If it's hosted on apache you could simply use mod rewrite to rewrite any url with oldcompany.com in it to newcompany.com's default page.

[code]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.oldcompany.com$ [OR]
RewriteCond %{HTTP_HOST} ^oldcompany.com$
RewriteRule ^(.*)$ http://www.newcompany.com/ [R=301,L]
[/code]


Thanks! i tried that earlier but for some reason it wasnt working right, i think it was cloudflare messing things up?
Works perfect now.

Thanks again!




2531 posts

Uber Geek
+1 received by user: 940

Subscriber

  Reply # 919159 21-Oct-2013 13:11
Send private message

I should point out that due to the ^ operator, it won't rewrite subdomains other than www, so, mysite.oldcompany.com for example wouldn't be redirected. You could either remove the ^ operator (thus just %{HTTP_HOST} oldcompany.com$) which should work though I must admit I've not tested it, or add more conditions for the various subdomains, if there are any.

Create new topic



Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.