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.


BinaryLimited

796 posts

Ultimate Geek

Trusted

#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
LennonNZ
2459 posts

Uber Geek

ID Verified
Trusted

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

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





BinaryLimited

796 posts

Ultimate Geek

Trusted

  #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.





TwoSeven
1623 posts

Uber Geek

Subscriber

  #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
   (the practice of real science, engineering and management)
A.I.  (Automation rebranded)
Gender Neutral
   (a person who believes in equality and who does not believe in/use stereotypes. Examples such as gender, binary, nonbinary, male/female etc.)

 

 ...they/their/them...




BinaryLimited

796 posts

Ultimate Geek

Trusted

  #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




Inphinity
2780 posts

Uber Geek


  #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]

BinaryLimited

796 posts

Ultimate Geek

Trusted

  #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!




Inphinity
2780 posts

Uber Geek


  #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





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

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



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.