logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: HELP problem with redirect
Author
vprajapa



Joined: 01 Dec 2006
Posts: 1

PostPosted: Fri 01 Dec '06 20:56    Post subject: HELP problem with redirect Reply with quote

Seems like

Code:
RedirectPermanent /cgi-bin/file.pl http://www.website.com

doesn't seems to be working. However if I put anything else except cgi-bin it works.
Then I wrote rewrite rule with condition like this.

Code:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)/file.pl
RewriteRule ^(.*)/file\.pl$ http://www.website.com [R=301,L]


Again it works for everything else except cgi-bin. SO it works when I put in
http://www.website.com/cgi-bi/file.pl or anythingelse except cgi-bin.
I know it is probably because cgi-bin is set to script directory and it treats it differently, so is there any way around it? Crying or Very sad
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Sat 02 Dec '06 17:58    Post subject: Reply with quote

vprajapa,

I cannot duplicate your problem with Apache 2.2.3 on Windows 2000.

Either RedirectPermanent or RewriteRule (or both) works correctly for me, regardless of whether I also have a ScriptAlias for /cgi-bin.

Perhaps you could enable more detailed logging for mod_rewrite with:
Code:
     RewriteLog logs/rewrite.log     
     RewriteLogLevel 9


You should see entries like this in rewrite.log:
Quote:
(2) init rewrite engine with requested uri /cgi-bin/file.pl
(3) applying pattern '^(.*)/file\.pl$' to uri '/cgi-bin/file.pl'
(4) RewriteCond: input='GET /cgi-bin/file.pl HTTP/1.1' pattern='^[A-Z]{3,9}\ /(.*)/file.pl' => matched
(2) rewrite '/cgi-bin/file.pl' -> 'http://www.website.com'
(2) explicitly forcing redirect with http://www.website.com
(1) escaping http://www.website.com for redirect
(1) redirect to http://www.website.com [REDIRECT/301]

Do you have any other directives in your httpd.conf which refer to cgi-bin (except for ScriptAlias)?

-tom-
Back to top


Reply to topic   Topic: HELP problem with redirect View previous topic :: View next topic
Post new topic   Forum Index -> Apache