Solved

htaccess Redirect

Posted on 2013-05-12
2
585 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Some of the SEO trends we might expect in 2017.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…

749 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