Question

SymLinks not being followed in htaccess

I have CentOs with Apache.

In my httpd.conf I have

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

and further down

<VirtualHost *:80> ServerAdmin me@mydomain.com DocumentRoot /var/www/mydomain.com/public_html ServerName www.mydomain.com ServerAlias mydomain.com ErrorLog /var/www/mydomain.com-error_log CustomLog /var/www/mydomain.com-access_log 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:

/var/www/error/mypage.htm

rather than:

/var/www/mydomain.com/public_html/mypage.htm

any ideas?

thanks


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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: http://css-tricks.com/data-uris/

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/mydomain.com/public_html/error to /var/www/error/mydomain and changing the httpd.conf paths e.g. <br> <br>ErrorDocument 404 /mydomain.com/public_html/error/404.htm <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