Gossamer Forum
Home : Products : Gossamer Links : Discussions :

mod_rewrite rules

Quote Reply
mod_rewrite rules
Just wanted to let you guys know i'm teed off at you..
This board got me started on how to do mod rewrite/rules, etc... and have not had any sleep for about 28 hours... going to bed now,
mod_rewrite, what a wonderful thing!!

Cool

</not a clue>

Last edited by:

Dinky: Sep 12, 2004, 6:09 AM
Quote Reply
Re: [Dinky] mod_rewrite rules In reply to
After all that did you get it working ?

Regards

minesite
Quote Reply
Re: [minesite] mod_rewrite rules In reply to
Yep, Smile completely redid my site, now working on my forums..
I know, said I was going to bed...
Crazy

</not a clue>
Quote Reply
Re: [Dinky] mod_rewrite rules In reply to
Now another question about rewrites...
Is there any way to have a rewrite set up so if someone was to type in http://www.mysite.com/bob
and bob is not one of your directories, instead of going to an error page, it would redirct to your search.cgi in a query and return http://www.mysite.com/cgi-bin/search.cgi?query=bob instead???

</not a clue>

Last edited by:

Dinky: Sep 12, 2004, 6:47 AM
Quote Reply
Re: [Dinky] mod_rewrite rules In reply to
Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^.+/(.+)/$ http://www.mysite.com/cgi-bin/search.cgi?query=$1 [R,L]

Try tris rewrite rule.
It should work, but not tested... use with care...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Dinky] mod_rewrite rules In reply to
I use this on my sites;

Code:
RewriteRule ^search/(.*)$ /cgi-bin/search.cgi?query=$1

This seems to work fine;

http://www.cool-clipart.com/search/ball

Be aware though, that you need to probably use this code in error.html too;

http://www.gossamer-threads.com/...i?post=271830#271830

Basically, just do something like;

<%build_root_url%>/search/<%GT::CGI::escape($query)%>

Hope that helps :)

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!
Quote Reply
Re: [Andy] mod_rewrite rules In reply to
Well, Dinky wants such solution, that if a user asks for an unexisting directory, then do a search on his site with the name of the directory.

Unfortunately there seems to be a small bug in my rewrite rule. If
http://www.mysite.com/bob
is entered, should work fine.

But if
http://www.mysite.com/bob/house/door
is entered, then it will use 'bob/house/door' for keyword in Search:
http://www.mysite.com/cgi-bin/search.cgi?query=bob/house/door'

So I'm thinking, that a script based rewrite rule would be needed, where the needed actions can be done. But this is much slower, than using the built-in regexps, especially, if script is executed in CGI mode, and in not Persistent Environment.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...