Solved

Redirect one URL to another in Apache 2

Posted on 2010-11-17
1
417 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
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
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). #…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

14 Experts available now in Live!

Get 1:1 Help Now