Solved

Redirect one URL to another in Apache 2

Posted on 2010-11-17
1
422 Views
Last Modified: 2012-05-10
I look after an Apathe web server that has multiple web sites via vhosts files defined in /etc/apache2/vhosts.enabled

I have three sites www.anuenterprise.com.au, www.anuenterprise.com and www.anutech.com.au that resolve to the same IP. I would like to set up the following

user enters www.anuenterprise.com in browser and is redirected to www.anuenterprise.com.au
user enters www.anutech.com.au in browser and is redirected to www.anuenterprise.com.au

All attempt to redirect in the vhosts files has failed so far.
0
Comment
Question by:dlg654
[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
1 Comment
 
LVL 13

Accepted Solution

by:
dsmile earned 500 total points
ID: 34161349
Create a file named .htaccess with content as attached code and put it in document root of your site


RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.anuenterprise\.com\.au$ [NC]
RewriteRule ^(.*)$ http://www.anuenterprise.com.au/$1 [R=301,L]

Open in new window

0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
New OSQA server has a ton of fake users 4 78
web server dns redirect 5 61
htaccess - disable PHP in specific directory 1 17
Certificate Request CentOS/Apache 1 18
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

763 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