You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alain Roger <ra...@gmail.com> on 2012/01/07 00:31:39 UTC

[users@httpd] virtualhost on localhost with .htaccess

Hi,

on my local computer (localhost on windows 7) i installed Apache to use
Joomla.
I setup virtual host (\apache\conf\extra\httpd-vhosts.conf) and it works
great.

now for each virtual host, i would like to use a special .htaccess file, so
i added:
AccessFileName .htaccess

here is an example of a virtualhost:
<VirtualHost *:80>
  DocumentRoot "d:/webserver/www/rogtek17"
  ServerName rogtek17.loc
  ServerAlias www.rogtek17.loc
  ErrorLog "logs/rogtek17.loc.error.log"
  CustomLog "logs/rogtek17.loc.access.log" common

  AccessFileName .htaccess

  <Directory "d:/webserver/www/rogtek17">
    AllowOverride AuthConfig FileInfo
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
  </Directory>

</VirtualHost>

1. is it correct or should i also update the standar httpd.conf file in the
\apache\conf\ folder ?
2. How to be sure that it is well configured ?


thx.
-- 
Alain
-----------------------------------------------------------
Windows 7 x64 / Fedora 14 x64
PostgreSQL 8.3.5 / MySQL 5
Apache 2.2.16
PHP 5.3.1
C# 2005-2008

Re: [users@httpd] virtualhost on localhost with .htaccess

Posted by Knute Johnson <ap...@knutejohnson.com>.
I'll preface this with I'm not an expert but why not just put whatever you have in the htaccess file in your Directory section.  Everything is in one place.

I don't think you need to modify httpd.conf.

If it works it's probably good.


Alain Roger <ra...@gmail.com> wrote:

>Hi,
>
>on my local computer (localhost on windows 7) i installed Apache to use
>Joomla.
>I setup virtual host (\apache\conf\extra\httpd-vhosts.conf) and it
>works
>great.
>
>now for each virtual host, i would like to use a special .htaccess
>file, so
>i added:
>AccessFileName .htaccess
>
>here is an example of a virtualhost:
><VirtualHost *:80>
>  DocumentRoot "d:/webserver/www/rogtek17"
>  ServerName rogtek17.loc
>  ServerAlias www.rogtek17.loc
>  ErrorLog "logs/rogtek17.loc.error.log"
>  CustomLog "logs/rogtek17.loc.access.log" common
>
>  AccessFileName .htaccess
>
>  <Directory "d:/webserver/www/rogtek17">
>    AllowOverride AuthConfig FileInfo
>    Order deny,allow
>    Deny from all
>    Allow from 127.0.0.1
>  </Directory>
>
></VirtualHost>
>
>1. is it correct or should i also update the standar httpd.conf file in
>the
>\apache\conf\ folder ?
>2. How to be sure that it is well configured ?
>
>
>thx.
>-- 
>Alain
>-----------------------------------------------------------
>Windows 7 x64 / Fedora 14 x64
>PostgreSQL 8.3.5 / MySQL 5
>Apache 2.2.16
>PHP 5.3.1
>C# 2005-2008

--  

Knute Johnson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] virtualhost on localhost with .htaccess

Posted by Steve Swift <Sw...@swiftys.org.uk>.
That looks about right. The only reason (that I can think of) for using
.htaccess files is if you want to devolve control of a virtualhost to the
person who has write access to the documentroot (where you'd normally store
the .htaccess file, thought they can also be used in subdirectories as
well). This requires a degree of trust between you (the server owner) and
the owner of the virtualhost, depending on which powers you give away.

I run apache under my Windows XP, and have two or three virtualhosts, but
they all belong to me, so I don't bother with .htaccess - but if you run
into problems, I can tinker with my own system to help work out what you
need to do. I'm somewhat familiar with htaccess from my
www.swiftys.org.uksite, as that is hosted for me, and I'm obliged to
configure it using
.htaccess

Incidentally, my main reason for using VirtualHosts is to intercept people
who send requests to my IP address (81.2.123.82) rather than the hostname (
swiftys.org.uk). Requests to the IP *address* will go to the default
VirtualHost, and that blocks all accesses.

On 6 January 2012 23:31, Alain Roger <ra...@gmail.com> wrote:

> Hi,
>
> on my local computer (localhost on windows 7) i installed Apache to use
> Joomla.
> I setup virtual host (\apache\conf\extra\httpd-vhosts.conf) and it works
> great.
>
> now for each virtual host, i would like to use a special .htaccess file,
> so i added:
> AccessFileName .htaccess
>
> here is an example of a virtualhost:
> <VirtualHost *:80>
>   DocumentRoot "d:/webserver/www/rogtek17"
>   ServerName rogtek17.loc
>   ServerAlias www.rogtek17.loc
>   ErrorLog "logs/rogtek17.loc.error.log"
>   CustomLog "logs/rogtek17.loc.access.log" common
>
>   AccessFileName .htaccess
>
>   <Directory "d:/webserver/www/rogtek17">
>     AllowOverride AuthConfig FileInfo
>     Order deny,allow
>     Deny from all
>     Allow from 127.0.0.1
>   </Directory>
>
> </VirtualHost>
>
> 1. is it correct or should i also update the standar httpd.conf file in
> the \apache\conf\ folder ?
> 2. How to be sure that it is well configured ?
>
>
> thx.
> --
> Alain
> -----------------------------------------------------------
> Windows 7 x64 / Fedora 14 x64
> PostgreSQL 8.3.5 / MySQL 5
> Apache 2.2.16
> PHP 5.3.1
> C# 2005-2008
>



-- 
Steve Swift
http://www.swiftys.org.uk