Directory fix? and location of .htaccess? .. please help

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Directory fix? and location of .htaccess? .. please help

Postby muchalipski » 14. August 2007 04:47

When I visit my www.myname.com/images via web browser, it shows a root directory. Where in my httpd do I change this? or is this located else where?

Also if any one cares to explain where does the .htaccess go? :?:

Thank you,
SKi
muchalipski
 
Posts: 2
Joined: 14. August 2007 04:39

Re: Directory fix? and location of .htaccess? .. please help

Postby Izzy » 14. August 2007 05:50

muchalipski wrote:When I visit my www.myname.com/images via web browser, it shows a root directory. Where in my httpd do I change this? or is this located else where?

http://httpd.apache.org/docs/2.3/mod/mo ... dexoptions

http://httpd.apache.org/docs/2.3/mod/core.html#options
Options Directive wrote:Warning

Mixing Options with a + or - with those without is not valid syntax, and is likely to cause unexpected results.



In your xampp\apache\conf\extra\httpd-vhosts.conf file you may have a Directory Directive similar to this:
Code: Select all
<Directory "C:/xampp/path/to/your/website" >
Options +Indexes +FollowSymLinks +Includes +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

You will see +Indexes which is the Index Options Directive that gives you the unwanted file listing if no index.html/index.php is present in a directory.

You need to change this to -Indexes and you will then be given:
Code: Select all
Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
When trying to access a directory without an index file.

(Or in the default Directory Directive in the httpd.conf file you would add -Indexes after Options +FollowSymLinks

Options +FollowSymLinks -Indexes

This would default all directories to no directory file listing and give the Error 403 page.

You would then have to change any directory you want to have a file listing by adding Options +Indexes in a .htaccess file in that directory to override the default settings you set in your httpd.conf file).

Note
By far the best solution and the most user friendly I have found to control directory listings in a given directory is to put either a blank index.html/index.php or a redirecting index.html/index.php file in the directory that sends the user to your home page or gives them a much friendlier error message.

If you look at most content manager scripts like Joomla etc. you will find they adopt this blank index.html strategy.

muchalipski wrote:Also if any one cares to explain where does the .htaccess go? :?:

http://httpd.apache.org/docs/2.3/howto/htaccess.html

Normally the .htaccess file goes into the root directory of your web site and controls all those files in the web site root directory and all the sub directories and their files under the root.

Or you can place a .htaccess file in a directory by directory basis.
HTH

=================================================
Take a look at the new DeskTopXampp launch control posted by ridgewood:
http://community.apachefriends.org/f/viewtopi ... 967#103967

The DeskTopXampp launch control for XAMPP and XAMPPlite (DTX.exe)
is available here:
http://zedfiles.com/DTX/

I highly recommend DTX.
=================================================
Last edited by Izzy on 02. September 2007 04:35, edited 2 times in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Thank you ^^

Postby muchalipski » 14. August 2007 06:21

All right, thanks Izzy! :wink:
muchalipski
 
Posts: 2
Joined: 14. August 2007 04:39


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 36 guests