Solved

Need Apache Rewrite Engine rule to redirect URLs

Posted on 2007-03-22
1
306 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This video teaches users how to migrate an existing Wordpress website to a new domain.
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.

747 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

11 Experts available now in Live!

Get 1:1 Help Now