Hi,
I am running WordPress and I have about 20 different urls as alias to our main url.
I have domain.co.nz, domain.net.nz, domain.cc and domain.com.au , domain.net
I need to redirect all www.domain and domain. to our main url of www.domain.net
What is the best rules to do this in the .htaccess directory
Hi
That did not work, firefox complained about incorrect redirects
dklynn
4
SPECIFICITY!
If the domain is not www.domain.net, make it so.
That is easily encoded in mod_rewrite as:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\\.domain\\.com$ [NC]
RewriteRule .? http://www.domain.com%{REQUEST_URI} [R=301,L]
Since you’re using WP, REMOVE the <IfModule> wrappers and insert this RewriteCond and RewriteRule immediately after WP’s RewriteEngine on statement.
Regards,
DK
Hi DK,
Spot on, thank you for your assistance.
dklynn
6
Cs,
Sorry, I overlooked the fact that you’re new here so a belated Welcome to SitePoint! to you!
Then, do you understand the reason to delete the <IfModule> wrapper?
Regards,
DK
Hi DK,
Must be honest, no. I was having a problem with WP dealing with multiple domains and would love to have a better understanding