Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My site is written in PHP. I have changed its urls from php to html and reconvert it in .htaccess file.

I put autocomplete jquery ui widget in a page of my site and its call to remote file to get suggested items doesn't work. Because the remote url is changed to


I put this line in htaccess file but it doesn't matche because it doesn't consider anything after \.html.

RewriteRule ^search\.html?term=([^-]+)$ search.php?term=$1 [L,NC,NS]

I also tried

RewriteRule ^search\.html\?term=([^-]+)$ search.php?term=$1 [L,NC,NS]

but both doesn't work.

Would you help me?
Thank you.

share|improve this question
up vote 4 down vote accepted

You need to tell Apache to append the query string (QSA = Query string append)

 RewriteRule ^search\.html$ search.php [L,NC,NS,QSA]

^search\.html$ is a regular expression matching a literal search.html. ^ matches from the beginning, $ matches till the end and \. matches a literal dot instead of any character (the special meaning of a dot in regular expressions)

This rule...

  • Matches a request for search.html (RewriteRule ^search\.html$)
  • and rewrites it to search.php,
  • processing no rules after this one ([L]),
  • match case insensitive (e.g. Search.HTML would be rewritten too) ([NC])
  • will not be used for subrequests ([NS])
  • and will finally append the original Query string after search.php ([QSA])

For an overview of flags:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.