LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-22-2005, 06:43 PM   #1
Cool_Hand_Luke
Member
 
Registered: Feb 2005
Posts: 40

Rep: Reputation: 15
Apache Default Index


Ok, I have apache configured to default to index.html in directories other then root. Is there away to configuring it so I don't need the slash?


Just curious as I hate it when a server error pops up if someone forgets to enter the slash.

Cheers,

Cool Hand...
 
Old 03-22-2005, 06:46 PM   #2
calcon
Member
 
Registered: Mar 2005
Location: somewhere over the rainbow theres a place....
Distribution: Ubuntu Dapper and Arch
Posts: 121

Rep: Reputation: 15
I don't thinks this is a Linux issue, it is an Apache issue.

Anywho, I would try using Mod Rewrite (http://httpd.apache.org/docs/mod/mod_rewrite.html). I've never used it, so I can't be of help there, but take a look at the link I gave you.

calcon
 
Old 03-23-2005, 02:08 AM   #3
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Drop the trailing slash off your DocumentRoot and/or Directory directives.

ie use

DocumentRoot /var/www

<Directory /var/www/somefolder>
...........
</Directory>

Last edited by DaHammer; 03-23-2005 at 02:09 AM.
 
Old 03-23-2005, 07:25 AM   #4
Cool_Hand_Luke
Member
 
Registered: Feb 2005
Posts: 40

Original Poster
Rep: Reputation: 15
Bamm baby Thanks! I'll test that out tonight.


Cheers,

Cool Hand...
 
Old 03-24-2005, 10:00 AM   #5
Cool_Hand_Luke
Member
 
Registered: Feb 2005
Posts: 40

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by DaHammer
Drop the trailing slash off your DocumentRoot and/or Directory directives.

ie use

DocumentRoot /var/www

<Directory /var/www/somefolder>
...........
</Directory>
So I tried the above,

DocumentRoot /var/www/html

<Directory /var/www/html/camscamps>

nothing is here now..... should there be?
</Directory>


Doesn't seem to do anything. I restarted the server and I still need to type..

http://www.example.com/camscamps/

I would really like to get rid of that slash at the end....

Cheers,

Luke
 
Old 03-24-2005, 01:43 PM   #6
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Are you loading mod_dir?

From the Apache website: 'Provides for "trailing slash" redirects and serving directory index files'
 
Old 03-25-2005, 12:20 AM   #7
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Quote:
Originally posted by Cool_Hand_Luke
So I tried the above,

DocumentRoot /var/www/html

<Directory /var/www/html/camscamps>

nothing is here now..... should there be?
</Directory>
Yes, there should be something there else there is no need for the "Directory" directive. I posted that directive only as an example if you're using it. The "Directory" directive is used to set settings for specific directories. You'd have one for the root of your site and then you'd use others to add or change things on a directory by directory basis, if you need to. For instance, I disallow all access to the root of my site by default:
Code:
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
So then I'd use it to allow access to one of the virtualhosts:
Code:
<Directory "/www/www.somesite.org">
    Order allow,deny
    Allow from all
</Directory>
Now anyone can access anything under that website. But then I have another directory where I want to list files vs load an index.html, so I add a few mod_autoindex options for that directory that I want to use:
Code:
<Directory "/www/www.somesite.org/files">
    IndexOptions FancyIndexing
    ReadmeName README.TXT
    Options Indexes FollowSymlinks
</Directory>
Anyway, I simply meant to not add the "/" at the end for those directives. That's all. The manual states the following:
Quote:
There appears to be a bug in mod_dir which causes problems when the DocumentRoot has a trailing slash (i.e., "DocumentRoot /usr/web/") so please avoid that.
But yes, as stickman stated, you need to make sure that mod_dir is loaded for the redirects to work correctly. It usually is in most default httpd.conf files. Also, you should probably run "/path/to/httpd -t" to test your configuration after making changes, as well.
 
Old 03-25-2005, 12:16 PM   #8
Cool_Hand_Luke
Member
 
Registered: Feb 2005
Posts: 40

Original Poster
Rep: Reputation: 15
Thank you It worked.

Cheers,

Cool Hand...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
changeing default document from index.html in apache thebover Linux - Software 3 03-30-2005 10:26 PM
How to change the default index.html in Apache bngrhl Linux - Newbie 2 06-08-2004 02:47 PM
Apache segmentation fault with with default index files paijm021 Linux - Software 13 04-22-2004 09:51 AM
Apache won't default to index.html TexasDex Linux - Software 5 04-05-2004 09:33 AM
In apache, i want to set my default page to be index.html, or something thep Linux - Newbie 3 04-17-2001 03:27 AM


All times are GMT -5. The time now is 12:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration