PDA

View Full Version : Second Domain and .htacess



nedjuric
11-04-2004, 07:04 PM
I just added a second domain to my account (Value), which points to a specific subdirectory in the site. The original is site1.com and the new domain is site2.com.

New domain points to site1.com/site2homedir/
( /www/htdocs/site2homedir/ )

I added password protection using .htaccess file to site2.com/dir1/ - its not working

If i go to site1.com/site2homedir/dir1/ it's ok.

What did I do wrong ?

wildjokerdesign
11-04-2004, 09:31 PM
I don't know if this would make a difference or not but /www/htdocs/ is actually sym links to /var/www/html. It may be that if you changed the path for your second domain to /var/www/html/site2homedir/ it may fix the problem.

The other option might be that you need to manually make some changes to your httpd.conf. Not sure what you would need to change but the reason I think this is shown in the examples below. In the httpd.conf file there is something like this:


<Directory "/var/www/html">
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
#AllowOverride None
AllowOverride All
</Directory>


If you look at the toward the bottom of the file you should see something like this:


<Directory "/www/htdocs">
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
</Directory>


It seems as if the /www/htdocs path is treated differently then /var/www/html.

Also how long ago did you add the second domain. Has it fully propegated? I have seen cases where it takes up to 72 hours for the second domain to "kick in" so to speak.

Keep us informed. Let us know if you try changeing the path to /var/www/html/site2homedir and it works.

jalal
11-05-2004, 01:30 AM
Without knowing what is in your .htaccess file its rather difficult to tell you what you are doing wrong! :)

However, what you want to do shouldn't be a problem technically, I do the same on many sites.

Also, despite what Shawn has written above, an .htaccess file is, in general, dealing with URL's, so whether it is /www/htdocs or /var/www/html is irrelevant.

HTH

nedjuric
11-05-2004, 02:58 AM
Thanks for helping :lol:
I change the path to /var/www/html/site2homedir and it works.
site2.com/dir1/ is password protected

Thanks !!!

walt
02-18-2005, 09:27 PM
I have a variation of this same problem, but the solution above doesn't seem to work for me.

The root for site1.com is at
/var/www/html

site2.com points to
/www/htdocs/a/b/site2dir

I can set security for site1.com/a/b/site2dir/target/ and it works. But I can still access the directory without security by going to site2.com/target/.

When I try to set security for site2.com/target/, it appears to create the password, but the site comes up in IE without the password box. I thought maybe IE was supplying the password automatically, so I deleted the old PW and added a new one; still no password box, and I get into the site.

Using the tip in the previous posts, I tried to rename the site2.com path
/www/html/a/b/site2dir
but I got an error message saying that path "is not a directory."

I used WebPassword to set this up. When I scan my directories using Site Manager, I never see a .htaccess or httpd file.

What am I missing?

cheers

wildjokerdesign
02-19-2005, 08:27 AM
The one thing I see is when you tried changing your path you missed part of it. the correct path to try to change it to would be

/var/www/html/a/b/site2dir

You dropped the /var at the beginning.

See if that works. That is going to be the easiest if it works for you.

I'm not 100% sure about this but when you say you looked for the .htaccess file using Site Manager I assume you mean the File Manager that is part of it. It may be that program does not show .htaccess files. Most of use around here do not use the File Manager and don't think to highly of it. :) There are some alternatives out there that you can use many of the Free. I think the WH manual list some with links to where you can get them.

walt
02-19-2005, 04:51 PM
Yep, it works. Thanks, wildjoker.

But this platform is getting curiouser and curiouser!

I left off the /var because it was never included in my site2 path (at least, according to Domain Manager). Here's why:

Using the Domain Manager part of File Manager, if you click NEW to add a new domain, and then click the "custom" radio button, the form pre-fills "/www/htdocs/" in the domain path. Following that cue, I created the path as "/www/htdocs/a/b/site2dir". I thought at the time that was a curious representation, but DM let me do that, and everything seemed OK as I set up files and tested the site. (BTW, DM would not permit "/www/html/a/b/site2dir", because that is, in fact, not a valid path.)

Following your tip, I edited the path (using Domain Manager) to "/var/www/html/a/b/site2dir" and security now works. (I deleted and re-installed the security records.)

Which leaves me with the question: What is htdocs about? (I won't ask why Domain Manager pre-fills that; I'm quickly learning not to like File Manager.) This seems to imply that "sometimes" htdocs=html, and sometimes not.

I'm spending a lot of time on and off the WH site studying documentation to get up to speed. I still have a lot to learn, including looking at alternatives to Site Manager as you suggest.

wildjokerdesign
02-19-2005, 09:02 PM
Glade it worked for you. If come up with more questions we are to give you what help we can. :)

Not sure why the default of /www/htdocs/ it is one way to get to /var/www/html/ through links. I try to use what I think of the true path /var/www/html/ in scripts and other things... just seems to work best. I'm sure there is some technical explenation but I'm the type that if it works then use it.

asuant1
07-20-2005, 09:19 PM
Here's an interesting password related question. Anybody know if it's possible to have the following setup:

2 domains
main (want to password protect entire site i.e. domain1.com):
located at /var/www/html
.htpasswd file located in /home/domain1
.htaccess for main page (i.e. located in /var/www/html)

2nd (want to password protect subdirectory i.e. domain2.com/dir):
located at /var/www/html2
domain2.htpasswd file located in /home/domain1
.htaccess for subdirectory of site (i.e. located in /var/www/html2/dir)

This is how I have it setup right now. The password protection on the main domain is working fine, but the password protection on the subdirectory of the 2nd domain is not (i.e. it just lets me go to the page without asking for a username/password).

Any insight would be appreciated - thanks!

jalal
07-21-2005, 02:06 AM
What do you have in the second .htaccess file?

asuant1
07-21-2005, 09:54 AM
Basically, what you'd expect, I assume:



AuthUserFile /home/domain1/domain2.htpasswd
AuthGroupFile /dev/null
AuthName "Admin Area"
AuthType Basic

<Limit GET>
require valid-user
</Limit>