Question

SymLinks not being followed in htaccess

Posted August 3, 2013 24.2k views
I have CentOs with Apache. In my httpd.conf I have Options FollowSymLinks AllowOverride None and further down 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 Options +FollowSymLinks AllowOverride All Order allow,deny Allow from all 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

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.

×
Submit an Answer
33 answers
I have CentOs with Apache.

In my httpd.conf I have

\
Options FollowSymLinks
AllowOverride None
\

and further down

\
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
\
Options +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
\
\

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
P.S. repost as I didnt know i had to escape
oki given up on trying to escape this, grr
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


above are bits that wouldnt escape with the less than/more than signs removed
Please pastebin the Virtualhosts - http://pastie.org
what all of them? I dont really want all the info online forever
http://pastie.org/8203045
Here's the full file with just some privacy changes:

i.e. mydomain.com being one domain, mydomain2.com being another completely different domain name etc

http://pastie.org/private/e5kvbwzk39wn33l71ug
If you want to enable symlinks for the first virtualhost (/var/www/mydomain.com/public_html), add this before </VirtualHost>

https://p.kk7.me/tuhotijunu.xml (make sure you restart Apache after editing the file).

Let me know if that fixes it.
I've tried that.

Maybe this issue is unrelated to symlinks in fact, sorry for the confusion I'm not sure whats really going on.

Here's the issue:

I've tried using a RewriteBase but that won't work either.

On my old host this used to work fine.

should come out as:

http://mydomain.com/mypage.htm

and find the page

but now it comes out as:

http://mydomain.com/full_server_path_to_file

and doesnt load the page
Paste the contents of .htaccess
Previous 1 2 3 4 Next