I want when search form submitted, the URL be like this :
localhost/xampp/external/proj3/search/searchquery
Instead of this:
localhost/xampp/external/proj3/tools/search/search.php?query=searchquery
You can use this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteBase /xampp/external/proj3
# external redirect from action URL to pretty one
RewriteCond %{THE_REQUEST} /search(?:\.php)?\?query=([^\s&]+) [NC]
RewriteRule ^ search/%1? [R=302,L,NE]
# internal forward from pretty URL to actual URL
RewriteRule ^search/([^/.]+)/?$ search.php?query=$1 [L,QSA,NC]
Create a .htaccess
file in your document root. And put this:
RewriteEngine On
RewriteRule ^search/([a-zA-Z0-9]+)/?$ \
search.php?query=$1 \
[NC,L]
Note: Be careful with the regular expression. Filter it cautiously.