Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

htaccess Redirect

Posted on 2013-05-12
2
Medium Priority
?
599 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

886 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