Solved

htaccess Redirect

Posted on 2013-05-12
2
557 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Read about why website design really matters in today's demanding market.
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 Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now