Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm using xampp with apache on my windows machine. My directory structure is:

C:/xampp/htdocs
---------------/Sync
--------------------/ProtectedFolderA
-------------------------------------/.htaccess
-------------------------------------/A.zip, B.zip ...
--------------------/ProtectedFolderB
--------------------/etc
------------------------/.htpasswd, htgroup

I want to list the ProtectedFolderA and B if I open localhost/Sync/. They contain some files which are restricted by HTTP Auth. If i open them they should list the files in the way specified in the htaccess. The etc directory contains some images and css. I also change some preferences like header and icons. So this is my .htaccess in ProtectedFolderA:

RewriteEngine On
AuthType Basic
AuthName "Restricted Directory"
# Only allow request after authentication
AuthUserFile c:/xampp/htdocs/Sync/etc/.htpasswd
AuthGroupFile c:/xampp/htdocs/Sync/etc/.htgroup
require valid-user

Options +Indexes
IndexOptions HTMLTable
IndexOptions FancyIndexing
IndexOptions IconsAreLinks
IndexOrderDefault Descending Name
IndexStyleSheet C:/xampp/htdocs/Sync/etc/file_style.css
HeaderName C:/xampp/htdocs/Sync/etc/file_head.html
IndexOptions FoldersFirst
IndexOptions NameWidth=90
IndexIgnore *.php *.htaccess *.html *.xhtml *.xmi *.xml *.png *.jpg *.css *.txt
AddIconByType C:/xampp/htdocs/Sync/etc/file_stock_index_down.png application/zip 
<Files *.zip>
deny from all
</Files>
<filesMatch A.zip>
AuthName "Download A.zip"
AuthType Basic
Require group A
Order allow,deny
Allow from all
</filesMatch>

<filesMatch B.zip>
AuthName "Download B.zip"
AuthType Basic
Require group B
Order allow,deny
Allow from all
</filesMatch>

<filesMatch C.zip>
AuthName "Download C.zip"
AuthType Basic
Require group C
Order allow,deny
Allow from all
</filesMatch>

But there are no changes on the icons. Are the path to the css and pictures are wrong? I can't open the css file in the code view.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
 <head>
  <title>Index of /Sync/V6</title>
  <link rel="stylesheet" href="C:/xampp/htdocs/Sync/etc/file_style.css" type="text/css">
 </head>
 <body>

Firefox says that it doesnt know the protocol "C". But I don't know a better path?! I don't know what I'm doing wrong. RewriteEngine is enabled. Some ideas?

share|improve this question

migrated from stackoverflow.com Mar 29 '13 at 12:00

This question came from our site for professional and enthusiast programmers.

    
Have you not tried using relative paths? So, instead of C:\xampp\..., you would use ..\etc\... –  Mike Anthony Mar 26 '13 at 19:55
    
Yes I tried AuthUserFile ../etc/.htpasswd but apache error log says Could not open password file: C:/xampp/etc/.htpasswd which is totally weird because the parent folder from the .htacess is not xampp. So I used AuthUserFile ../htdocs/Sync/etc/.htpasswd and this works. For the Icons i can use the previous relative path. But the folder ProtectedFolderA is not shown in the Sync folder anymore. So an user can't know that its there. –  No3x Mar 27 '13 at 8:45
    
And the etc folder is shown anyway. Right the way I don't want to. It just contains resources that shouldn't be seen from a user. –  No3x Mar 27 '13 at 10:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.