views:

45

answers:

2

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
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
What for [L,R]? Please!
skipsoft
**L**: Last Rule, so no further rule will be checked.**R**: Redirect
jigfox
Thanks... I Get It.... WoW!
skipsoft