Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Rewrite Rule Horrors

Quote Reply
Rewrite Rule Horrors
Hi there Smile

I'm in a bit of a pinch here...
I have created rewrite rules for a GLinks website that I moved recently. The rules concerning the pages in the www/ directory is working fine,
but the rules rewriting url's containing cgi-bin/ are not affected. Here are two examples:

Rule 1: directory/(.*) www.mysite.com/$1 [R=301,L]

Rewrites www.mysite.com/directory/Detail/34.html to www.mysite.com/Detail/34.html (this is working)

Rule 2: cgi-bin/smallmotor/(.*) www.mysite.com/cgi-bin/$1 [R=301,L]

Should rewrite www.mysite.com/cgi-bin/smallmotor/search.cgi to www.mysite.com/cgi-bin/search.cgi (not working - reports: The requested URL /cgi-bin/smallmotor/search.cgi was not found on this server.)

Any ideas of what is going on here?Unsure

Thank you


Sacrifice is not about what you lose,
it is about what you gain in the process.
Quote Reply
Re: [EZFrag] Rewrite Rule Horrors In reply to
cgi-bin is often a directory not inside www, so the htaccess rules set in www aren't applied to the cgi-bin. You probably need to create a separate set of htaccess rules in your cgi-bin.

Adrian
Quote Reply
Re: [brewt] Rewrite Rule Horrors In reply to
Ahhh.... nice. Smile

Thanks, that is working now. It is interesting though how these rewrites function.
For example, I tried creating a file, .htaccess, in the cgi-bin directory, but it didn't work.
Here is its contents:

Code:
Rewriteengine on
RewriteBase /
Rewriterule cgi-bin/smallmotors/(.*) http://www.mysite.com/cgi-bin/$1[/url] [R=301,L]


Then I changed it to the following:

Code:
Rewriteengine on
RewriteBase /
Rewriterule smallmotors/(.*) http://www.mysite.com/cgi-bin/$1[/url] [R=301,L]

It seems that one should keep in mind the current directory of the .htaccess file when the conditions are constructed...

Thank youWink


Sacrifice is not about what you lose,
it is about what you gain in the process.

Last edited by:

EZFrag: Aug 21, 2008, 1:35 AM