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.




1917 posts

Uber Geek
+1 received by user: 110


Topic # 84909 10-Jun-2011 13:36

Hello there.

I am having an issue with our domain setup. Thanks to the wisdom of the manager; we have a website on a shared hosting plan with openhost that was not intended to be the production url. I do not wish to re-setup the entire WP site and structure on another hosting plan so I have setup a domain alias.

Sounds great but I wish to avoid the content duplication issue. So in the .htacess file I am redirecting the old domain to the new domain using;  

RewriteCond %{HTTP_HOST} ^old.co.nz
RewriteRule (.*) http://www.new.co.nz/$1 [R=301,L]

This works for the homepage, but it does not redirect for pages down the tree.
How can I redirect any url associated from the old domain to the new alias domain?


Thanks for any help :o) 
 

Create new topic
2345 posts

Uber Geek
+1 received by user: 373

Trusted

  Reply # 479718 10-Jun-2011 13:48
Send private message

RewriteCond %{HTTP_HOST} ^old.co.nz$ [NC]
RewriteRule ^(.*)$ http://new.co.nz/$1 [L,R=301]


Updated (twice) to be a little better..






Professional yak shaver
1599 posts

Uber Geek
+1 received by user: 8

Trusted
BitSignal
Subscriber

  Reply # 479719 10-Jun-2011 13:49
Send private message

Try this:

RewriteRule ^/(.*) http://www.new.co.nz/$1 [L,R]

EDIT: LennonNZ beat me to the punch. Smile 




"Roads? Where we're going, we don't need roads." - Doc Emmet Brown

 
 
 
 


Try Wrike: fast, easy, and efficient project collaboration software


1917 posts

Uber Geek
+1 received by user: 110


  Reply # 479734 10-Jun-2011 14:44

Thanks for the help... I tried that but it does not seem to work. I am unsure if this is because we have a wordpress rewrite in there as well. It redirects the homepage perfectly though.


This is the htaccess file;



<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


RewriteCond %{HTTP_HOST} ^iluvnewzealand.co.nz$ [NC]
RewriteRule ^(.*)$ http://iluvnz.co.nz/$1 [L,R]
</IfModule>



An example of the non-redirection is here : http://iluvnewzealand.co.nz/kiwi-o-meter

Professional yak shaver
1599 posts

Uber Geek
+1 received by user: 8

Trusted
BitSignal
Subscriber

  Reply # 479736 10-Jun-2011 14:46
Send private message

I think that second RewriteRule is conflicting with the last one. Not sure how I would change that, though.




"Roads? Where we're going, we don't need roads." - Doc Emmet Brown

2345 posts

Uber Geek
+1 received by user: 373

Trusted

  Reply # 479738 10-Jun-2011 14:47
Send private message

RewriteCond %{HTTP_HOST} ^iluvnewzealand.co.nz$ [NC]
RewriteRule ^(.*)$ http://iluvnz.co.nz/$1 [L,R=301]


13919 posts

Uber Geek
+1 received by user: 1754


  Reply # 479750 10-Jun-2011 15:16
Send private message

SteveON: Hello there.

I am having an issue with our domain setup. Thanks to the wisdom of the manager; we have a website on a shared hosting plan with openhost that was not intended to be the production url. I do not wish to re-setup the entire WP site and structure on another hosting plan so I have setup a domain alias.

Sounds great but I wish to avoid the content duplication issue. So in the .htacess file I am redirecting the old domain to the new domain using;  

RewriteCond %{HTTP_HOST} ^old.co.nz
RewriteRule (.*) http://www.new.co.nz/$1 [R=301,L]

This works for the homepage, but it does not redirect for pages down the tree.
How can I redirect any url associated from the old domain to the new alias domain?


Thanks for any help :o) 

 


 

Wouldn't you be best to contact the host, as they would know the settings for their server.



1917 posts

Uber Geek
+1 received by user: 110


  Reply # 479754 10-Jun-2011 15:30

Humm, looks like the rewrite does not work. I will just have to get a server setup for separate domains.

2345 posts

Uber Geek
+1 received by user: 373

Trusted

  Reply # 479760 10-Jun-2011 15:42
Send private message

See This.. http://stackoverflow.com/questions/4550829/htaccess-apache-url-rewrite-for-wordpress-permanently-poi...

You have to swap the order around...



RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^iluvnewzealand.co.nz$ [NC]
RewriteRule ^(.*)$ http://iluvnz.co.nz/$1 [L,R]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


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:





News »

IBM leads Call for Code to use cloud, data, AI, blockchain for natural disaster relief
Posted 25-May-2018 14:12


New FUJIFILM X-T100 aims to do better job than smartphones
Posted 24-May-2018 20:17


Stuff takes 100% ownership of Stuff Fibre
Posted 24-May-2018 19:41


Exhibition to showcase digital artwork from across the globe
Posted 23-May-2018 16:44


Auckland tops list of most vulnerable cities in a zombie apocalypse
Posted 23-May-2018 12:52


ASB first bank in New Zealand to step out with Garmin Pay
Posted 23-May-2018 00:10


Umbrellar becomes Microsoft Cloud Solution Provider
Posted 22-May-2018 15:43


Three New Zealand projects shortlisted in IDC Asia Pacific Smart Cities Awards
Posted 22-May-2018 15:14


UpStarters - the New Zealand tech and innovation story
Posted 21-May-2018 09:55


Lightbox updates platform with new streaming options
Posted 17-May-2018 13:09


Norton Core router launches with high-performance, IoT security in New Zealand
Posted 16-May-2018 02:00


D-Link ANZ launches new 4G LTE Dual SIM M2M VPN Router
Posted 15-May-2018 19:30


New Panasonic LUMIX FT7 ideal for outdoor: waterproof, dustproof
Posted 15-May-2018 19:17


Ryanair Goes All-In on AWS
Posted 15-May-2018 19:14


Te Papa and EQC Minecraft Mod shakes up earthquake education
Posted 15-May-2018 19:12



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.

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