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
2355 posts

Uber Geek
+1 received by user: 374

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



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

2355 posts

Uber Geek
+1 received by user: 374

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]


14215 posts

Uber Geek
+1 received by user: 1828


  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.

2355 posts

Uber Geek
+1 received by user: 374

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 »

Intel introduces new NUC kits and NUC mini PCs
Posted 16-Aug-2018 11:03


The Warehouse leaps into the AI future with Google
Posted 15-Aug-2018 17:56


Targus set sights on enterprise and consumer growth in New Zealand
Posted 13-Aug-2018 13:47


Huawei to distribute nova 3i in New Zealand
Posted 9-Aug-2018 16:23


Home robot Vector to be available in New Zealand stores
Posted 9-Aug-2018 14:47


Panasonic announces new 2018 OLED TV line up
Posted 7-Aug-2018 16:38


Kordia completes first live 4K TV broadcast
Posted 1-Aug-2018 13:00


Schools get safer and smarter internet with Managed Network Upgrade
Posted 30-Jul-2018 20:01


DNC wants a safer .nz in the coming year
Posted 26-Jul-2018 16:08


Auldhouse becomes an AWS Authorised Training Delivery Partner in New Zealand
Posted 26-Jul-2018 15:55


Rakuten Kobo launches Kobo Clara HD entry level reader
Posted 26-Jul-2018 15:44


Kiwi team reaches semi-finals at the Microsoft Imagine Cup
Posted 26-Jul-2018 15:38


KidsCan App to Help Kiwi Children in Need
Posted 26-Jul-2018 15:32


FUJIFILM announces new high-performance lenses
Posted 24-Jul-2018 14:57


New FUJIFILM XF10 introduces square mode for Instagram sharing
Posted 24-Jul-2018 14:44



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.