Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^cgi\-bin\/sales\/?(.*)$ "http\:\/\/example\.com\/cgi\-bin\/live\/$1" [R=301,L] [edited by: jdMorgan at 12:02 am (utc) on May 15, 2010]
[edit reason] Removed links, changed to example.com. Please see TOS. [/edit]
RewriteCond %{HTTP_HOST} ^sheepsystems.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.sheepsystems.com$
RewriteRule ^cgi\-bin\/sales\/?(.*)$ "http\:\/\/sheepsystems\.com\/cgi\-bin\/live\/$1" [R=301,L] /cgi-bin/salesblahblah as a valid URL request. Whoever wrote that code needs a severe talking to...Well, it was generated automatically by cPanel when I set up a "Redirect". I'll review your points, but it does seem to work without side effects. (cPanel is a website control panel which is provided by my web host.)
I hope you're aware that using the proxy flag messes up your server logs and analytics, as well as slowing down your site for all visitors, as the server has to make a new request for the page, and then organise passing the reply back to the browser.OK, I'll watch for any slowdown. The requests are typically quite tiny.
At this point is very important to understand the differences between an external redirect, an internal rewrite, an include, a same-domain proxy request and a cross-domain proxy request. They each have their place, and are very different in outcome, even though some are only a few characters different from each other in implementation.Thank you, g1smd. That gives me some terms to go learn about. My guess is that I did either an internal rewrite or a same-domain proxy request.
The first question is "Why did you want to do this redirect in the first place?"Thank you, Jim. Answer: I've published several applications which have different URLs hard-coded into them, and as a result of spring cleaning and reorganization, I want them to all hit the same scripts. After a few weeks, as users update, the redirects will be used less and less. After maybe 6 months I'll delete the this code from .htaccess.
By setting up a proxy through-put, you are causing your server to accept the client's (browser's) HTTP request, then make a new (outgoing) HTTP request to the URL you specified, accept the response from that server, and then pass it back to the originally-requesting client.I believe you're telling me that it's as I suspected...it's all done without involving the client, and furthermore it's all internal since it's actually the same server, example.com. It's forwarding from example.com/cgi-bin/sales/Whatever.pl to example.com/cgi-bin/live/Whatever.pl. So it should never leave the box it's running on until the final response.
This is not a redirect, and does not function as a redirect in terms of what search engines will make of it.I'm glad there's another word for it. As far as search engines, I believe that's not an issue since I have no interest in advertising these scripts to the public. They are hit either by an application which I publish, or with notifications from Paypal or Google Checkout. When hit with appropriate POST data, they will do one of: return pricing information, initiate an order, send out a key, mark a sale as completed, etc.
RewriteRule ^cgi-bin/sales(/.*)?$ cgi-bin/live$1 [L]