softlinks didn't work when browsing the DocumentRoot directory on Apache

Hello Experts,

I am using Redhat linux RHEL 5.3 OS with Apache running on it, in httpd.conf the DocumentRoot is /var/www/html, i created directory called 'pub' under the DocumentRoot i.e. /var/www/html/pub.
Any soft-links( to another directory)  created under /var/www/html/pub is not listed when access via browser. How can i access the soft links directories from web browser client.
Who is Participating?
sudhirgoogleConnect With a Mentor Author Commented:
I resolved the problem. It was issue with selinux, i used restorecon command to set the selinux context for the softlink directory and it worked like a charm.
In your configuration you'll need to set up a <directory> section and specify an option to allow following symlinks.
Similar could be done with .htaccess file.

Something like

<Directory /var/www/html/pub>
    Options Indexes FollowSymLinks

Open in new window
sudhirgoogleAuthor Commented:
I added above entries in httpd.conf file, and restarted httpd service,  but no luck.

will hard-link and soft-link both will work ??

which one i should use ?? hard-link or soft-link ??

i created using ' ln -s' command, is that correct or do i need to use 'ln -d  ' Please suggest.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Hmm, soft link should be fine
Try this (some may already exist):
<Directory "/var/www/html">
options Indexes Includes
AllowOverride All
Order allow,deny
Allow from all

<Directory "/var/www/html/pub">
options +FollowSymLinks

Open in new window

If still not working after a restart, please post full configuration file, check your apache error log file
May be a permission issue with the directories you are trying to access not being accessible by the "apache" user, assuming that is who its running as
sudhirgoogleAuthor Commented:
I tried as per your suggestion but still not working. i am here attaching the httpd conf file.
you did check your apache error logs yes?
try making a test directory you are symlinking to be owned by apache
obviously remember that apache is case sensitive

I assume the issue is these links aren't showing up the index? Does anything show up?
sudhirgoogleAuthor Commented:
I found solution myself. Thank for your reponses.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.