httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Evans <tevans...@googlemail.com>
Subject Re: [users@httpd] RedirectMatch using current server name
Date Fri, 12 Oct 2012 16:05:31 GMT
On Fri, Oct 12, 2012 at 3:22 PM, plot.lost <plot.lost@gmail.com> wrote:
> On 12/10/2012 15:19, Tom Evans wrote:
>>
>> On Fri, Oct 12, 2012 at 2:15 PM, plot.lost<plot.lost@gmail.com>  wrote:
>>>
>>> Is  there a way to do something like the following where the domain part
>>> is
>>> replaced by whatever has been configured in ServerName
>>>
>>> RedirectMatch permanent ^/$ http://the.domain.com/path/to/file.html
>>>
>>> i.e. where 'the.domain.com' is whatever the current ServerName is without
>>> having to edit the RedirectMatch line (it would be in a config section
>>> that
>>> gets included into several different virtual hosts). Want to keep this in
>>> the main config files, not in any .htacess files
>>>
>>> Thanks in advance for any help on this.
>>>
>> RedirectMatch permanent ^/$ /path/to/file.html
>>
>> Apache will construct a canonical URL from the '/path/to/file.html'
>> component, this will use the ServerName, if you have UseCanonicalName
>> on.
>>
>> Cheers
>>
>> Tom
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
> Thanks, that should do the job.
>
> Out of interest, if 'UseCanonicalName' was off would that cause the redirect
> to go to whatever hostname the client had used in the request - say for
> example if the vhost had a couple of aliases (I don't actually want to do
> that, just interested to know)
>
> Thanks again.
>

Yes, "UseCanonicalName off" would result in httpd using the values
supplied in the Host header.

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

Cheers

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message