whoto rewrite specific conditions in htaccess?

Have webpage with search in: index.php?search=foo need redirect all text http://foo.com/findme to index.php?search=findme but not 404 real files.

Example of this:

http://foo.com/john => find john
http://foo.com/john+abc => find john abc
http://foo.com/john.jpg => set 404 (if not exist)
http://foo.com/john/foo.jpg => set 404 (if not exist)
http://foo.com/john/foo.php => set 404 (if not exist)
http://foo.com/john/ => set 404 (if not exist)

Other result find the query string in php. Example: 11.111.111-1, 111111111, 22222.222-k, 11111111.1

Need black list in search by extension?

need all jpg, php, txt, xml, etc etc or directory (contain "/"), set 404 if not exist

Have this:

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !(\/) <=== dont work
RewriteRule ^(.*)$ /index.php?search=$1

Thanks.

Answers


You can try:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)$ /index.php?search=$1 [L,QSA]

Need Your Help

MIPS Boolean Branching Output

assembly boolean mips

I'm not entirely sure how to go about writing this program, and desperately need help:

Creating a Custom UIButton

cocoa-touch uikit uibutton

I am looking to create a Custom UIButton (not subclass) progrmatically, I would like it to have a background image that will stretch as the UIButton's width increases. How would I do this?