Forum Moderators: phranque

Message Too Old, No Replies

.htaccess and localhost virtual hosting

.htaccess restricts all in vhost but not in sever root

         

nyteshade

3:42 pm on Mar 8, 2010 (gmt 0)

10+ Year Member



I've been working with apache and php for about 6 months so I'm a nube no doubt. Recently I've learned how to set up virtual hosting on my home LAN development machine (WinXP,Apache HTTP2.2). I've set up a virtual host directory, entered the localhost in the Win hosts file, configured the httpd.conf file, in short performed the operations that successfully allow browsers to access the web server root or virtual directories that I've set up, no problem at all. However, I have an .htaccess file in the server root directory that works just fine, but when I put a copy of the same .htaccess file to the virtual host directory then I get an: INTERNAL SERVER ERROR, page displayed when pointing a browser at it, and yes there is an index.php file in the directory. My .htaccess file contains:

#disallow display of file names
options -indexes


This must be a rudimentary problem but I can not find an answer and could use some direction. Also, if there is a good soure, i.e., tutorial or book that gives a novice a good start working with Apache then please feel free to let me know. Thanking you in advance.

nyteshade

12:20 pm on Mar 9, 2010 (gmt 0)

10+ Year Member



Resolved! Interesting, my virtual hosting 'appeared' to be working, my attention was focused on my *.php files (that looked just fine) but I stumbled across some of my *.xhtml includes that were not being included! Changed:

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin me@live.com
DocumentRoot "C:/Program Files...
</VirtualHost>

//TO
NameVirtualHost MY.VIRTUALDOMAIN.COM:80
<VirtualHost MY.VIRTUALDOMAIN.COM:80>
ServerAdmin me@live.com
DocumentRoot "C:/Program Files...
</VirtualHost>

Of all the tutorials and sites that I visited... not one mentioned substituting the * with the domain! I had to learn it by experimenting. Oh, and thanks for noticing my pain.

jdMorgan

7:29 pm on Mar 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got that resolved, nyteshade, and thanks for posting your solution.

Sorry for the belated reply, but we have very few contributors here, and due to other pressing issues, I have been unable to tend to this forum much for the past week or so. As a result, some threads did not get any replies and that is regrettable. However, even under the best of circumstances, it may take more than 24 hours for a post to get a reply here; There are simply far more "askers" than "answerers."

Jim