help password protect folder with htaccess on addon domain

Oh, the strange things mod_rewrite does!

help password protect folder with htaccess on addon domain

Postby redrum » Thu Mar 26, 2009 6:46 pm

im trying to password protect my admin dir on an addon domain.

main domain: www.main.co.uk
addon domain: www.addon.com

public_html/ <-- (main domain)
public_html/addon.com <-folder for (addon domain)

i made a .htacces file in the admin dir of the addon domain.

Code: Select all
AuthUserFile /pass/public_html/addon.com/.passfile
AuthName "Private Area"
AuthType Basic
require valid-user


when upload the above .htaccess file adn try to access my admin dire i get the following error.

Not Found

The page you were looking for appears to have been moved, deleted or does not exist.

This is most likely due to:

* An outdated link on another site
* A typo in the address / URL



on the root of the addon.com folder there's a .htaccess file with the following.

Code: Select all
Options -MultiViews +FollowSymlinks -Indexes

<IfModule mod_security.c>
   # Turn off mod_security filtering.
   SecFilterEngine Off

   # The below probably isn't needed, but better safe than sorry.
   SecFilterScanPOST Off
</IfModule>

<IfModule mod_rewrite.c>
   RewriteEngine On
   # If your server is running PHP in CGI mode you will probably need to uncomment the following lines
   # Only uncomment lines that begine with Rewrite

   # The RewriteBase should be set to the same value as the AppPath setting in your config.php WITH a / on the end
   # RewriteBase /

   # This rewrite base rule is only required if you are getting 401 unauthorized errors when placing an order with Google Checkout
   # RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule . index.php
   <IfModule mod_env.c>
      SetEnv SEO_SUPPORT 1
   </IfModule>
</IfModule>

<IfModule mod_deflate.c>
   AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>


thanks in advance
redrum
 
Posts: 3
Joined: Thu Mar 26, 2009 5:54 pm

Postby richardk » Fri Mar 27, 2009 1:36 am

Try creating a 401 error document
Code: Select all
ErrorDocument 401 /somefile
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby redrum » Fri Mar 27, 2009 3:16 am

richardk wrote:Try creating a 401 error document
Code: Select all
ErrorDocument 401 /somefile


on which htaccess do i add the code?


sorry new to this
redrum
 
Posts: 3
Joined: Thu Mar 26, 2009 5:54 pm

Postby redrum » Fri Mar 27, 2009 4:29 am

got it working now...

i put this on the root of the addon domains .htaccess

Code: Select all
ErrorDocument 401 www.google.com


and also my admin .htaccess was missing the full path to the password file

Code: Select all
AuthUserFile /pass/public_html/addon.com/.passfile
AuthName "Private Area"
AuthType Basic
require valid-user


should've been

Code: Select all
AuthUserFile /home/myaccount/pass/public_html/addon.com/.passfile
AuthName "Private Area"
AuthType Basic
require valid-user


thanks for your help
redrum
 
Posts: 3
Joined: Thu Mar 26, 2009 5:54 pm


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 18 guests

cron