?
Solved

.htaccess redirect question

Posted on 2004-08-04
5
Medium Priority
?
896 Views
Last Modified: 2010-03-04
Hi,

I was wondering whether it was possible for the htaccess file to redirect the following requests, if my domain is www.mydomain.com:

http://www.mydomain.com/search/search?key=foo&id=1234

to

http://www.externaldomain.com/search/search?key=foo&id=1234

Basically what I want to do is to is just redirect any requests that come to my domains search folder to an external domain. Is this possible using htaccess and what is the code to do it?

Thanks
0
Comment
Question by:jambo69
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 1000 total points
ID: 11713891
RewriteCond %{HTTP_HOST} !^www.externaldomain.com$
RewriteRule ^(.*)$ http://www.externaldomain.com/$1
# just one possibility matching your ambigous requirement ;-)
0
 
LVL 9

Assisted Solution

by:rjkimble
rjkimble earned 1000 total points
ID: 11714383
I think that the rewrite rule should be this (note the "/" and the flags):

RewriteRule    ^/(.*)$    http://www.externaldomain.com/$1    [R,L]

If you want to restrict it to just /search/search, you can do this:

RewriteRule    ^/search/search$    http://www.externaldomain.com/search/search    [R,L]

You probably don't need the RewriteCond line, and you need to make sure that the rewrite engine is on. My suggestions look like one of these:

RewriteEngine on
RewriteRule    ^/(.*)$    http://www.externaldomain.com/$1    [R,L]

or:

RewriteEngine on
RewriteRule    ^/search/search$    http://www.externaldomain.com/search/search    [R,L]

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11714550
hehe, that was already coverd in "just one possibility"
anyway, useful suggestion too ..
0

Featured Post

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

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

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month12 days, 20 hours left to enroll

777 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