Gossamer Forum
Home : General : Internet Technologies :

mod_rewrite - should work but won't - driving me nuts :/

Quote Reply
mod_rewrite - should work but won't - driving me nuts :/
Hi,

Can anyone see why this wouldn't work?

Code:
RewriteRule search.cgi?query=(.*)$ http://www.google.com [L]

(I've only set it to point to google.com, as a test - to see if the condition works)

I've even tried escaping stuff:

Code:
RewriteRule search\.cgi\?query\=(.*)$ http://www.google.com [L]

The first one should work fine - but it just refuses too :/ (other mod_rewrite code in the same .htaccess file works fine - so I don't think thats the issue)

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] mod_rewrite - should work but won't - driving me nuts :/ In reply to
Hi,

Well, I kinda fixed a bit of it (there was a redundant .htaccess file in the cgi-bin)

However, I'm still having problems Pirate

This works:

Code:
RewriteRule search.cgi http://www.google.com [R]

..but this doesn't:

Code:
RewriteRule search.cgi\?query=(.*)$ http://www.google.com [R]

..I've also tried:

Code:
RewriteRule search.cgi?query=(.*)$ http://www.google.com [R]
RewriteRule search.cgi\?query\=(.*)$ http://www.google.com [R]

.. and neither of those work either Frown

Anyone got any suggestions?

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] mod_rewrite - should work but won't - driving me nuts :/ In reply to
Hi,

Well, I finally managed to find out why it didn't work (thanks to google <G>).

With mod_rewrite, the query string ISN'T part of the query - so you have to do a RewriteCond %{REQUEST_QUERY} kinda thing.

Just in case anyone else was interested :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!