Can somebody help me clean up my ugly php urls? It's probably pretty simple, but obviously not simple enough for me REWRITE www.domain.com/blue+cars (with or without trailing slash) TO www.domain.com/index.php?s=blue+cars The amount of words in the $s variable will vary, but probably won't ever be more than 5 separate words.
Try it: paste these lines in your .htaccess file : Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^/([^/]+)/?$ index.php?s=$1 [QSA,L]
Thanks, but it doesn't seem to work. I get a 404: The requested URL /blue+cars was not found on this server.
With a bit of cut and paste, I've got it to work. Slightly different to YIAMs suggestion (maybe it was typos?). But this works: RewriteRule ^([^/\.]+)/?$ index.php?s=$1 [QSA,L] It seems to work the same with or without the first two lines. Can someone tell me what they do? And if I need them or not. RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d