i am trying to create an .htaccess file that will achieve the following
- create a clean url like this http://www.mydomain.com/About-Us with page page.php?title=About Us
- query a database with the parameters passed on the url like this http://www.mydomain.com/?search=abc and it pulls to page index.php?search=abc
this is my code so far
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^?search=([0-9]*)$ index.php?id=$1 ## e.g www.mydomain.com/?search=try
RewriteRule ^([A-Z]*)$ page.php?name=$1
## www.mydomain.com/About-Us
##ErrorDocument 404 PageNotavailabale
####Protect the system from machines with worms
RewriteRule (cmd|root)\.exe - [F,E=dontlog:1]
#### To hold and redirect css/images/js files
RewriteRule images/(.+)?$ images/$1 [NC,L]
RewriteRule css/(.+)?$ css/$1 [NC,L]
RewriteRule js/(.+)?$ js/$1 [NC,L]
Why not using this kind of url for your search engine :
www.domain.com/search/abc?Then, your access your pages with
www.domain.com/<myPage>.And your search engine with
www.domain.com/search/<mySearch>EDIT :
Please notice your rules doesn’t allow a lot of params :
^?search=([0-9]*)$allows only numbers (even an empty parameter)^([A-Z]*)$allows only uppercase letters (and also empty parameter)