Solved

Need Apache Rewrite Engine rule to redirect URLs

Posted on 2007-03-22
1
310 Views
Last Modified: 2013-11-19
I have two URLs, www.url-1.com and www.url-2.com both  pointing to the same Apache-UNIX hosting account.  In the root ofthis account I have two index files, index_1.htm and index_2.htm.

When a visitor surfs to www.url-1.com, I want index_1.htm to load
but if they surf to www.url-2.com, I want  index_2.htm to load.

I'm looking at the Apache Rewrite Engine, and cannot for the life o me come up with a conditoin/rule set that will make this happen.

Anyone?

Thank
0
Comment
Question by:xfvgdrthbdtyvhgscv
1 Comment
 
LVL 10

Accepted Solution

by:
ClickCentric earned 500 total points
ID: 18776535
The following is from memory, but seems about right:


RewriteEngine on
RewriteBase /


RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\.url-1\.com$ [NC]
RewriteRule ^(.*)$ http://www.www.url-1.com/index_1.html [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.url-2\.com$ [NC]
RewriteRule ^(.*)$ http://www.www.url-2.com/index_2.html [R=301,L]
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

789 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