Blue Horn

Symfony Framework

How to handle dot in Symfony URL

December 4, 2008 by Sid in Symfony Framework with 2 Comments

This problem with dot in Symfony URL is a common issue faced by developers. I’ve seen people asking about it few times in the symfony-users mailing list, and in fact I have asked about it once. Here’s one recent thread about it in the mailing list.


When you have dot in your Symfony URL, e.g.: “http://localhost/mysymfonyapp/module1/action1/param1/”, your web application suddenly behaves incorrectly. Either error or something. After debugging, you’d find that the erratic behavior is caused by parameter ‘param1’ not containing ‘’ (as it should do … does?).


I found that the problem is caused by Symfony’s web/.htaccess. Especially the following line (red):

# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule .* – [L]

The above htaccess rule basically (as the comment says) skip all URL with dot in it, because it suppose to be URL to image, css, or javascript files. But sometime we do have dot in URL other than for accessing those files, for example if we pass email address in the URL.


There are two possible solutions that I know of.

One solution is to use question mark formatted parameter (e.g.: “module/action?” as opposed to “module/action/email/”) as pointed out here. I have not tried this myself but seems like a good solution.

The next possible solution is to modify web/.htaccess to suit your situation. For example, in my situation, I needed the dot because it was for email address. So I added the following line (green) which basically tells apache not to skip the URL even if it has dot if it has @ sign:

# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !@.+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule .* – [L]

I hope that helps…


Tagged ,

Related Posts


  1. MartinDecember 15, 2009 at 12:47 am

    This post was very helpful to solve my problem.

    Greetings from Germany

  2. SidJanuary 19, 2010 at 12:05 amAuthor


    Thanks for leaving a comment :)

Leave a reply

Your email address will not be published. Required fields are marked *


one × 5 =

My Projects
Restaurant Websites