Forum Moderators: phranque

Message Too Old, No Replies

A9.com RewriteRule or "search in the url"

How is it done?

         

moremoneytome

5:26 am on Apr 19, 2004 (gmt 0)

10+ Year Member




How do I make anything in the url become a search query, with some exceptions?

This is what I've tried:

RewriteRule ^(.+)$ /-/query?q=$1 [L]

However, I don't want to query when people ask for
/index.html
/index.php
/robots.txt
/favicon.ico
/-/anything-here...

How can I modify the RewriteRule to make it work?

Yidaki

6:32 am on Apr 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RewriteEngine on 
RewriteCond %{REQUEST_URI}!^/index\.html
RewriteCond %{REQUEST_URI}!^/index\.php
RewriteCond %{REQUEST_URI}!^/robots\.txt
RewriteCond %{REQUEST_URI}!^/favicon\.ico
RewriteCond %{REQUEST_URI}!^/-/anything-here
RewriteRule ^(.+)$ /-/query?q=$1 [L]

kevinsl

4:28 pm on Apr 20, 2004 (gmt 0)

10+ Year Member



Try something like this:


RewriteCond {%SCRIPT_FILENAME} !-f
RewriteRule ^/(.*) /search.php?query=$1 [L]

This might not be 100% correct but what is says is: any request which is NOT a regular file (index.php, robots.txt, etc), it will pass to search.php

kenken

10:41 am on Apr 21, 2004 (gmt 0)



I tried it but its not good condition.
The results are only the script name.
(eg: search.cgi...)