LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   (CentOS 5.3 server) httpd.conf configuration issue involving DirectoryIndex (https://www.linuxquestions.org/questions/linux-server-73/centos-5-3-server-httpd-conf-configuration-issue-involving-directoryindex-734298/)

xshad0wfx 06-19-2009 09:43 PM

(CentOS 5.3 server) httpd.conf configuration issue involving DirectoryIndex
 
im almost positive the issue is isolated with the httpd.conf, however i could be completely off. The issue involves links in my server and the DirectIndex file is being read. For example if you go to www.example.com/index and /index is not a directory but index.php i get a server error saying /index does not exists. but if i type in the url www.example.com/index.php it works fine. so im asking what the correct configuration for my server should be so /index can be read and not return a "Not found" error.

jhcaiced 06-19-2009 09:54 PM

Hi,

As I understand, if your request is
http://www.example.com/index apache searches for a directory
named 'index' and a file called index.html or index.php inside
that directory, using the DirectoryIndex directive to find
the file.

It could be wrong to add 'index' to DirectoryIndex because
without an extension, apache cannot determine the handler
to use, and a file named 'index' without extension will
be confusing so i don't see the point in having a file
called index when it should be easier to call it index.html

If you really need to have a 'index' member in your url then
maybe a rewrite rule or something like that can be
implemented, but again, i don't see the point.

xshad0wfx 06-19-2009 09:57 PM

thanks for your advice, the reason i asked on how to do this was because of a script/template im actually using to host my website, and i thought it'd be easier to just configure the httpd.conf instead of the actual script/template and hunt for the links. But thanks again.

billymayday 06-19-2009 10:10 PM

Try and entry like
Code:

DirectoryIndex index.php index.html index.htm index.shtml
but you shouldn't need the /index anyway (ie just www.example.com)

Edit - in fact, putting /index will probably break anything, since you are really telling apache to look for www.example.com/index/index.html or similar.

xshad0wfx 06-19-2009 10:32 PM

After looking at the script i realize that i cant edit the php files to direct the links to .php extensions because its trying to read /videos for example (which in the html folder is videos.php) as a file that can read and write directories. the best example i can show with the issue im dealing with is this ex: http://www.example.com/video/829/my-cool-video. (video) is actually video.php running a script directing the link you clicked to directory 829 where there's a video that is named 1.flv but that's masked in the browser. I know for a fact a configuration in my server is wrong because its reading everything as a directory and not as potential scripts. I have a feeling that there might be a mistake in the configuration of my php as well.


All times are GMT -5. The time now is 11:40 AM.