SymLinks not being followed in htaccess

  • Posted August 3, 2013

I have CentOs with Apache.

In my httpd.conf I have

<Directory /> Options FollowSymLinks AllowOverride None </Directory>

and further down

<VirtualHost *:80> ServerAdmin DocumentRoot /var/www/ ServerName ServerAlias ErrorLog /var/www/ CustomLog /var/www/ common <Directory /> Options +FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>

And in my .htaccess in my public_html folder I have at the top:

RewriteEngine On Options +FollowSymLinks

However, the links (e.g. a RewriteRule $ /error/mypage.htm [R=302,L]) are generated as:


rather than:


any ideas?



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Perfect, thanks so much, I never thought to do that :)

One way to fix this is to just base64 the image and use it as a data uri in the img element:

So the rest of the site functions fine it just seems to be the ErrorDocument in particular that is perhaps getting blocked by .htaccess. I managed to get it to work by moving them from /var/www/ to /var/www/error/mydomain and changing the httpd.conf paths e.g. <br> <br>ErrorDocument 404 / <br> <br>This works, but it won’t load the images on the page. I have them in the same folder and reference them like img src=“404.jpg” in the code

Try commenting out all the rules in .htaccess - does it work without it?

So either it was working last night and it has mysteriously broken today, or 24 hours without sleep took it’s toll on my last night and I thought it was fixed! <br> <br>my httpd.conf <br> <br> <br>my .htaccess (extract of, all links behave the same way) <br> <br> <br>Basically it tries to fetch: <br> <br> <br> <br>with an absolute url e.g. /error/updating.htm I get: <br> <br> <br> <br>This appears correct but the file is “not found” (and of course it can’t find the 404.html either because it cant find anything!)

OK I tell a lie, I’m getting myself confused. I did have this working last night but its no longer working when i got up this morning. The RewriteEngine being off just redirected to index.html hence my confusion.

So I realised what was causing the problem of the URLs not being found. I had “RewriteEngine On” at the top of my .htaccess and removing this fixed it (I noticed this after I accidentally uploaded an old version and ran into the same problem again).

Hi, Thanks managed to get it sorted now with your help and other bits of fiddling around. The allowoverride all fixed it but there were some other issues I had to resolve first to get it working properly :)

I’ve added “allowoverride all” to all my virtual hosts (most of which are empty i should point out), it has brought me back an old error I previously had but resolved. I get apache test page and error: <br> <br>Directory index forbidden by Options directive: /var/www/

Oops, that was supposed to read: <br><pre><Directory /var/www/…></pre> <br> <br>and if <code>AllowOverride Fileinfo Options</code> doesn’t work, THEN try <code>AllowOverride All</code>