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 mod rewrite rule mysteriously cuts off the periods from my query string.

For example, this is the request url:


this is the query string I want:


but this is what I get


Here is my mod_rewrite configuration

Options -Indexes
Options +FollowSymLinks
RewriteEngine On

RewriteRule ^tag/([^/]*)/([^/]*)(/?)$ f.php?tag=$1&clear=$2 [L,QSA]

How can I fix this problem?

share|improve this question
Could you please give us the exactly apart after the Search+For+Articles? I also suggest you enabling RewriteLog and setting RewriteLoglevel to see what the log says. – quanta Aug 21 '11 at 5:00

I think the problem may be with your Apache configuration itself... I created a simple f.php script on one of my Apache2 servers that simply consisted of the following:


I then created the .htaccess file with the exact contents you specified in your question. Now when I hit I got a 404 error. However if I called it as I got the output I expected. I then went back to my Apache config and found that the Directory listing for the path I was working in had AllowOverride None so I changed it to AllowOverride All and attempted the /tag/... prefixed URI and low and behold I received the following output:

    [REDIRECT_STATUS] => 200
    [HTTP_HOST] =>
    [PATH] => /usr/local/bin:/usr/bin:/bin
    [DOCUMENT_ROOT] => /var/www
    [SERVER_ADMIN] => webmaster@localhost
    [SCRIPT_FILENAME] => /var/www/f.php
    [REMOTE_PORT] => 35393
    [REDIRECT_QUERY_STRING] => tag=2&clear=Search+For+Articles...
    [REDIRECT_URL] => /tag/2/Search+For+Articles...
    [QUERY_STRING] => tag=2&clear=Search+For+Articles...
    [REQUEST_URI] => /tag/2/Search+For+Articles...
    [SCRIPT_NAME] => /f.php
    [PHP_SELF] => /f.php
    [REQUEST_TIME] => 1313889895

I've cleaned up some of the variables specific to my server but as you can see the QUERY_STRING is as expected.

share|improve this answer
This is good info but I still can't get it to work it seems to always drop the ... – needHELP Aug 21 '11 at 3:16
What is your server environment? I did this on an Ubuntu Server 11.04 with Apache 2.2.17. Aside from the AllowOverride change I didn't touch anything within the existing default Apache server config. The .htaccess was what you had put forth. – Jeremy Bouse Aug 21 '11 at 14:11

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.