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

Uber Geek
+1 received by user: 370

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

2334 posts

Uber Geek
+1 received by user: 370

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]


13369 posts

Uber Geek
+1 received by user: 1599


  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.

2334 posts

Uber Geek
+1 received by user: 370

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 »

UAV Traffic Management Trial launching today in New Zealand
Posted 12-Dec-2017 16:06


UFB connections pass 460,000
Posted 11-Dec-2017 11:26


The Warehouse Group to adopt IBM Cloud to support digital transformation
Posted 11-Dec-2017 11:22


Dimension Data peeks into digital business 2018
Posted 11-Dec-2017 10:55


2018 Cyber Security Predictions
Posted 7-Dec-2017 14:55


Global Govtech Accelerator to drive public sector innovation in Wellington
Posted 7-Dec-2017 11:21


Stuff Pix media strategy a new direction
Posted 7-Dec-2017 09:37


Digital transformation is dead
Posted 7-Dec-2017 09:31


Fake news and cyber security
Posted 7-Dec-2017 09:27


Dimension Data New Zealand strengthens cybersecurity practice
Posted 5-Dec-2017 20:27


Epson NZ launches new Expression Premium Photo range
Posted 5-Dec-2017 20:26


Eventbrite and Twickets launch integration partnership in Australia and New Zealand
Posted 5-Dec-2017 20:23


New Fujifilm macro lens lands in New Zealand
Posted 5-Dec-2017 20:16


Cyber security not being taken seriously enough
Posted 5-Dec-2017 20:13


Sony commences Android 8.0 Oreo rollout in New Zealand
Posted 5-Dec-2017 20:08



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.