Redirect one URL to another in Apache 2

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, and that resolve to the same IP. I would like to set up the following

user enters in browser and is redirected to
user enters in browser and is redirected to

All attempt to redirect in the vhosts files has failed so far.
Who is Participating?
dsmileConnect With a Mentor Commented:
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 ^(.*)$$1 [R=301,L]

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.