You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by software <so...@polin.it> on 2002/11/29 13:55:44 UTC

[users@httpd] mod_dir trailing slash rewrite and ServerAlias

Hi!

A friend of mine is asking:

Here is the problem. With mod_dir enabled, when a request comes in for that is for a directory withouth the trailing slash on the end, the requested url is rewritten with the slash appended.

Example:

www.domain.tld/foo
gets rewritten to

www.domain.tld/foo/

But, the problem is with ServerAliases. Example: 

<VirtualHost *>
  ServerName www.domain.com
  ServerAlias www.foobar.com
</VirtualHost>

The redirect gets written using the server name. So a request to:

www.foobar.com/foo

gets rewritten as

www.domain.com/foo/

What is the solution to making the rewrite use the HTTP_HOST rather than the server name? 

Could you help me to answer to him ?

Thanks!


Re: [users@httpd] mod_dir trailing slash rewrite and ServerAlias

Posted by software <so...@polin.it>.
Zac and Boyle,
thank you both!!!!
I tried it locally and it worked!!!

I have no words to say you THANKS!

Cheers,
Mr Andrea from Italy.

---------------------------------------------------------------------
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] mod_dir trailing slash rewrite and ServerAlias

Posted by Zac Stevens <zt...@cryptocracy.com>.
On Sat, Nov 30, 2002 at 12:35:20AM +0100, dale's stuff wrote:
> So if I understand your answer correctly, in my case where I have a number 
> of domains pointing to the same place, and where I would prefer the MAIN 
> domain to be used for all, I should set "UseCanonicalName" to ON?

That's correct (and is the default).  Note however that this affects only
server-generated responses.  If you'd like all requests to show up with the
same 'main' hostname, regardless of how the client got there, take a look
at 

http://httpd.apache.org/docs/mod/core.html#usecanonicalname


HTH,


Zac

---------------------------------------------------------------------
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] mod_dir trailing slash rewrite and ServerAlias

Posted by dale's stuff <st...@colony.net>.
So if I understand your answer correctly, in my case where I have a number 
of domains pointing to the same place, and where I would prefer the MAIN 
domain to be used for all, I should set "UseCanonicalName" to ON?

On Friday, November 29, 2002, at 02:23  PM, Zac Stevens wrote:

> On Fri, Nov 29, 2002 at 01:55:44PM +0100, software wrote:
>> What is the solution to making the rewrite use the HTTP_HOST rather than 
>> the server name?
>>
>> Could you help me to answer to him ?
>
> He needs to put 'UseCanonicalName Off' in his VirtualHost container.
> Take a look at the following for more info:
>
> http://httpd.apache.org/docs/mod/core.html#usecanonicalname
>
> HTH,
>
>
> Zac


---------------------------------------------------------------------
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] mod_dir trailing slash rewrite and ServerAlias

Posted by Zac Stevens <zt...@cryptocracy.com>.
On Fri, Nov 29, 2002 at 01:55:44PM +0100, software wrote:
> What is the solution to making the rewrite use the HTTP_HOST rather than the server name? 
> 
> Could you help me to answer to him ?

He needs to put 'UseCanonicalName Off' in his VirtualHost container.
Take a look at the following for more info:

http://httpd.apache.org/docs/mod/core.html#usecanonicalname

HTH,


Zac

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