Solved

Apache Rewrite rule

Posted on 2011-09-12
6
257 Views
Last Modified: 2012-06-27
I want to have exchange.com be a redirect to the homepage of solution.com, but would it be possible to have exchange.com/savings be a redirect to the savings page? Or possibly savings.adhdtreatmentinfo.com?. If possible what would be the rewrite rule.
0
Comment
Question by:udaybobbala
6 Comments
 
LVL 4

Expert Comment

by:vvk
ID: 36525419
you probably need to use Redirect or RedirectMatch since it looks like you're using different server. or is solution.com content exist on the same server? then it'll not be going to solution.com through rewrite it'll just fetch content from different location
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36525445
Your question is not very clear.

Are you saying that you want:
http://exchange.com redirect to http://solution.com
and
http://exchange.com/savings redirect to http://savings.adhdtreatmentinfo.com

?
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36525456
You might try this:

# I want to have exchange.com be a redirect to the homepage of solution.com
RewriteCond %{HTTP_HOST} exchange.com$
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule .* www.solution.com

# would it be possible to have exchange.com/savings be a redirect to the savings page? Or possibly savings.adhdtreatmentinfo.com
RewriteCond %{HTTP_HOST} exchange.com$
RewriteCond %{REQUEST_URI} ^/savings$
RewriteRule (.*) $1.adhdtreatmentinfo.com

Open in new window

0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Author Comment

by:udaybobbala
ID: 36525804
I am sorry small modification in the question.


http://exchange.com redirect to http://solution.com
and
http://exchange.com/savings redirect to http://savings.exchange.com

All the pages of exchange.com should be redirected to solution.com home page except one sub page exchange.com/savings redirected to the savings page of exchange.com ( http://savings.exchange.com)
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 300 total points
ID: 36525844
So...
# except one sub page exchange.com/savings redirected to the savings page of exchange.com
RewriteCond %{HTTP_HOST} exchange.com$
RewriteRule ^(savings)(/.*) $1.exchange.com$2 [L]

# All the pages of exchange.com should be redirected to solution.com home page
RewriteCond %{HTTP_HOST} exchange.com$
RewriteRule (.*) www.solution.com/$1

Open in new window

0
 

Author Closing Comment

by:udaybobbala
ID: 36529714
I still need to test it in integration.

Thanks for your fast reply.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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