Solved

Apache Rewrite rule

Posted on 2011-09-12
6
258 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
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.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Curl Multi-exec 13 71
Ubuntu 14 with Apache 7 75
Logs to delete in Windows VCenter server ? 11 525
whm high memory usage in processes 7 88
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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