You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ann Hopkins <se...@handypaws.com> on 2007/05/03 20:36:22 UTC

[users@httpd] Stupid Question: Canonical Name Rewrite Location

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a server with multiple hosts names on one IP address. I have
figured out from all the searches I made that I can do rewrite the
other hosts names to "correct" the address to "www".

ServerName www.example.com:80
ServerName a.example.com:80
ServerName b.example.com:80
ServerName c.example.com:80
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^/(.*) http://www.example.com/$1 [L,R]


My question is all the examples I have seen are within a "Virtual
Host" directive.  I don't see any problem with making it global as I
only have one IP address to worry about.

My stupid question is:

Why "Virtual Host"?  Is there some sort of security issue with
having the "RewriteEngine on" in the master file?

I would appreciate someone giving me an answer either way.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGOiulhs7JGk93PT0RAlNfAJ9YvhE3v0xiHCgMX01QMJvfYBgwZgCdEOSJ
PJWo+MRbkPZtHvjW9t8JbkY=
=bxrQ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] Stupid Question: Canonical Name Rewrite Location

Posted by Joshua Slive <jo...@slive.ca>.
On 5/3/07, Ann Hopkins <se...@handypaws.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> The "Virtual Host" directive is the only one that takes
> "ServerAlias".  This actually works in the main configuration file
> or a Virtual Host directive.

Right, but you still can't have more than one ServerName. The server
is just using the last one. You should be putting only the canonical
hostname in ServerName.

But the fact is, if UseCanonicalName is set Off, then ServerName has
very little effect on anythin.

Joshua.

---------------------------------------------------------------------
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] Stupid Question: Canonical Name Rewrite Location

Posted by Ann Hopkins <se...@handypaws.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The "Virtual Host" directive is the only one that takes
"ServerAlias".  This actually works in the main configuration file
or a Virtual Host directive.

The Apache documentation implies what I tried to be okay, but
specific website examples from other people and searching this
mailing list only showed it being used with "Virtual"

Thanks again.


Joshua Slive wrote:
> On 5/3/07, Ann Hopkins <se...@handypaws.com> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> I have a server with multiple hosts names on one IP address. I have
>> figured out from all the searches I made that I can do rewrite the
>> other hosts names to "correct" the address to "www".
>>
>> ServerName www.example.com:80
>> ServerName a.example.com:80
>> ServerName b.example.com:80
>> ServerName c.example.com:80
>> RewriteEngine on
>> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
>> RewriteRule ^/(.*) http://www.example.com/$1 [L,R]
>>
>>
>> My question is all the examples I have seen are within a "Virtual
>> Host" directive.  I don't see any problem with making it global as I
>> only have one IP address to worry about.
>>
>> My stupid question is:
>>
>> Why "Virtual Host"?  Is there some sort of security issue with
>> having the "RewriteEngine on" in the master file?
> 
> If you don't have any virtual hosts, then you can certainly put
> RewriteEngine, etc in the main config. I don't know what examples you
> are talking about, but it could be placed inside a <VirtualHost> just
> because people dealing with multiple hostnames typically already have
> some <VirtualHost>s setup.
> 
> By the way, you should only have a single ServerName in the main part
> of your config.
> 
> Joshua.
> 
> ---------------------------------------------------------------------
> 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
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGOi/Chs7JGk93PT0RApdSAJ4o/daFKsZxVTtD4guVIbErJuNI+gCeMzLi
0wK/mucwbJ7LeJwYrM53hOQ=
=nvhu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] Stupid Question: Canonical Name Rewrite Location

Posted by Joshua Slive <jo...@slive.ca>.
On 5/3/07, Ann Hopkins <se...@handypaws.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I have a server with multiple hosts names on one IP address. I have
> figured out from all the searches I made that I can do rewrite the
> other hosts names to "correct" the address to "www".
>
> ServerName www.example.com:80
> ServerName a.example.com:80
> ServerName b.example.com:80
> ServerName c.example.com:80
> RewriteEngine on
> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
> RewriteRule ^/(.*) http://www.example.com/$1 [L,R]
>
>
> My question is all the examples I have seen are within a "Virtual
> Host" directive.  I don't see any problem with making it global as I
> only have one IP address to worry about.
>
> My stupid question is:
>
> Why "Virtual Host"?  Is there some sort of security issue with
> having the "RewriteEngine on" in the master file?

If you don't have any virtual hosts, then you can certainly put
RewriteEngine, etc in the main config. I don't know what examples you
are talking about, but it could be placed inside a <VirtualHost> just
because people dealing with multiple hostnames typically already have
some <VirtualHost>s setup.

By the way, you should only have a single ServerName in the main part
of your config.

Joshua.

---------------------------------------------------------------------
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