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.


SteveON

1917 posts

Uber Geek


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

Uber Geek

Trusted

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






magu
Professional yak shaver
1599 posts

Uber Geek

Trusted
BitSignal
Lifetime subscriber

  #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

 
 
 
 


SteveON

1917 posts

Uber Geek


  #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

magu
Professional yak shaver
1599 posts

Uber Geek

Trusted
BitSignal
Lifetime subscriber

  #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

LennonNZ
2434 posts

Uber Geek

Trusted

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


mattwnz
16739 posts

Uber Geek


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

SteveON

1917 posts

Uber Geek


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

 
 
 
 


LennonNZ
2434 posts

Uber Geek

Trusted

  #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




News »

Amazon introduces new Echo devices
Posted 25-Sep-2020 11:56


Mad Catz introduces new S.T.R.I.K.E. 13 Mechanical Gaming Keyboard
Posted 25-Sep-2020 11:34


Vodafone NZ upgrades international submarine network
Posted 25-Sep-2020 09:09


Jabra announces wireless noise-cancelling airbuds, upgrade existing model
Posted 24-Sep-2020 14:43


Nokia 3.4 to be available in New Zealand
Posted 24-Sep-2020 14:34


HP announces new HP ENVY laptops aimed at content creators
Posted 24-Sep-2020 14:02


Logitech introduce MX Anywhere 3
Posted 21-Sep-2020 21:17


Countdown unveils contactless shopping with new Scan&Go tech
Posted 21-Sep-2020 09:48


HP unveils new innovations for businesses adapting to rapidly evolving workstyles and workforces
Posted 17-Sep-2020 15:36


GoPro launches new HERO9 Black camera
Posted 17-Sep-2020 09:45


Telecommunications industry launches new 5G Facts website
Posted 17-Sep-2020 07:56


New Zealand ranks 3rd in world in GSMA index
Posted 15-Sep-2020 10:13


Trend Micro Security Suite adds web monitoring to prevent identity theft
Posted 14-Sep-2020 15:37


NVIDIA to acquire Arm for US$ 40 billion
Posted 14-Sep-2020 12:27


Epson launches its next gen A3+ colour EcoTank multi-function printer
Posted 10-Sep-2020 16:08



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.