Please help me. How can I do for www.example.com/search.php?q=skipsoft to www.example.com/skipsoft?
A:
Without using JavaScript (which is a bad idea to modify the essential parts of a website, e.g. search), you won't be able to make forms submit data to a page that's not in the form /pagename?q=query or w/e.
But if you'd just like to shave of the .php extension, this will do the trick:
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
In your .htaccess file, this will make it so that any file with a .php extension can be accessed without one.
aharon
2010-06-24 16:23:07
A:
If you want to redirect everything you can do something like this in your .htaccess
file if you're using apache:
RewriteEngine On
RewriteRule ^(.*)$ /search.php?q=$1 [L,R]
But I would recommend something like this:
RewriteEngine On
RewriteRule ^/s/(.*)$ /search.php?q=$1 [L,R]
This will match www.yourdomain.com/s/author to www.yourdomain.com/search.php?q=author.
jigfox
2010-06-24 16:29:18
What for [L,R]? Please!
skipsoft
2010-06-24 16:44:17
**L**: Last Rule, so no further rule will be checked.**R**: Redirect
jigfox
2010-06-24 16:53:00
Thanks... I Get It.... WoW!
skipsoft
2010-06-24 17:05:28