Solved

Redirect one URL to another in Apache 2

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

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

Suggested Solutions

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

813 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

16 Experts available now in Live!

Get 1:1 Help Now