Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I have the resources shared with another project. The pictures of the products I will show are stored in a folder out of my new project for which I'm using symfony...

In my symfony project, in the /web/images folder, I created a symbolic link to the folder where my pictures are stored. I'm sure the permissions of every file and folder under the pictures folder pointed by the symlink are set to 777, anyone can access them.

Everything worked fine until I enabled the mod rewrite of apache. Pictures on the /web/images folder were shown perfectly, but anything accessible through the symlink wasn't shown. I immediately thought the symlink was the reason for this behavior, and I checked my apache configuration for the site. Also, reading on symfony, I examined the .htaccess file under the /web folder and added the line:

Options FollowSymLinks

This didn't work either.

Here's my site configuration:

<VirtualHost *:80>
    #ServerAdmin webmaster@localhost

    #DocumentRoot /var/www
    DocumentRoot /srv/www/
    <Directory />
        Options FollowSymLinks
        #AllowOverride None
        AllowOverride All
        Order allow,deny
        allow from all
    #<Directory /var/www/>
    <Directory /srv/www/>
        Options Indexes FollowSymLinks MultiViews
        #AllowOverride None
        AllowOverride All
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        #AllowOverride None
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        #Options +ExecCGI -MultiViews +FollowSymLinks
        Order allow,deny
        Allow from all

    #ErrorLog ${APACHE_LOG_DIR}/error.log
    ErrorLog /srv/www/

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    #CustomLog ${APACHE_LOG_DIR}/access.log combined
    CustomLog /srv/www/ combined

    Alias /sf /home/victor/projects/vitoquen/tienda/lib/vendor/symfony/data/web/sf
    <Directory "/home/victor/projects/vitoquen/tienda/lib/vendor/symfony/data/web/sf">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from All

    #Alias /doc/ "/usr/share/doc/"
    #<Directory "/usr/share/doc/">
    #    Options Indexes MultiViews FollowSymLinks
    #    #AllowOverride None
    #    AllowOverride All
    #    Order deny,allow
    #    Deny from all
    #    Allow from ::1/128


And here's my .htaccess:

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  Options FollowSymLinks

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

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

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]


Any suggestions??

I tried mounting the folder with the --bind option, and it didn't work! This, I think, can mean that the symlink was not the only problem.

Files in the pictures folder are stored without extension. Because of that, I can't use the image_tag() helper of symfony, which appends .png by default to the file name if no extension is given... this is the way I'm displaying images in my template:

if (strcmp($producto->foto, "SI") == 0) {
    echo '<img src="/images/productos/'.$producto->id.'_muestra" width="102" height="84"  alt="Imagen de muestra"/>';
} else {
    echo '<img src="/images/no_picture.jpg" width="102" height="84" alt="Imagen de muestra"/>';

The strange thing is that /images/no_picture.jpg is shown perfectly. Thanks again for any help you can give me!!!

BTW! I have the same configuration on two test servers; one using Debian 6 and the other one with Ubuntu 11.04. I have the same behavior on both servers.

PS: Sorry for my english! thanks to nikai who corrected my spelling...

share|improve this question
As you can see, i have not enough reputation to answer my own question. I solved my problem in maybe not the best way, but I got it to work. I created another .htaccess file under the /web/images folder, and wrote this: Options +FollowSymLinks +ExecCGI <IfModule mod_rewrite.c> RewriteEngine Off </IfModule>. It just disables apache's mod_rewrite only for the /web/images folder. Any better solution is welcome!!! – Throoze Aug 23 '11 at 23:42

Your Answer


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

Browse other questions tagged or ask your own question.