Solved

htaccess Redirect

Posted on 2013-05-12
2
582 Views
Last Modified: 2013-05-12
Hi,

I have 2 domains linked to the one website on my server (.net.au and .com.au). I want all access directed to the .com.au. I currently have the below in my htaccess file which works fine.

RewriteCond %{HTTP_HOST} ^www.domain.net.au$ [NC]
RewriteRule ^(.*)$ http://www.domain.com.au/$1 [L,R=301]

One little problem, if the user types the address domain.net.au without the www. it still takes them to the net.au address. I need the www. and non www. on domain.net.au to go to the .com.au.

What rule do i need to add to achieve this?
I've tried adding a few rules and can't seem to get it working.
Any help will be appreciated, thanks.
0
Comment
Question by:JiveMedia
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39159489
RewriteCond %{HTTP_HOST} ^domain.net.au$  [OR]
RewriteCond %{HTTP_HOST} ^www.domain.net.au$

RewriteRule ^(.*)$ http://www.domain.com.au/$1 [L,R=301]
0
 
LVL 32

Expert Comment

by:DrDamnit
ID: 39159611
Just as an alternative, it's better to configure that in the site definition with the server alias directive.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SEO can be a real minefield to navigate, but there are three simple ways to up your SEO game just be re-assessing your content output.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question