i have installed wordpress on my site, i have used the built in modrewite, when i post a item, the url is like: http://www.domain.com/my-item/ the url is works well with the following code: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] and i have add my file to the blog, the file is search.php, and i want turn http://www.domain.com/search.php?name=search word to http://www.domain.com/search_word.html so i added this line to the .htacess file RewriteRule ([0-9a-zA-Z_???]*).html /search.php?name=$1 but it will not works, can anyone help me how to write this code? thanks
I tested this and it works. RewriteEngine On RewriteBase / RewriteRule ^([A-Za-z0-9_]*)\.html$ /search.php?name=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Code (markup): The placement of the custom rewrite rule is important IF you (temporarily) can change it to RewriteRule ^([A-Za-z0-9_]*)\.html$ /search.php?name=$1 [R,L] It will redirect and you can see in the location bar how the url is being rewritten and tweak as needed.