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] .htaccess redirect issue
Date Thu, 27 May 2010 09:03:30 GMT
On Thu, May 27, 2010 at 9:50 AM, J. Bakshi <joydeep@infoservices.in> wrote:
> On 05/27/2010 01:59 PM, Nilesh Govindarajan wrote:
>> I assume that you want to redirect abcd.mydomain.com to
>> www.mydomain.com/?domain=abcd.mydomain.com
>> Considering that scenario and limiting subdomains only to
>> mydomain.com, the following rule works (I've tested them on my
>> server):
>>
>> RewriteEngine On
>> RewriteCond %{HTTP_HOST} (.+).mydomain.com$
>> RewriteRule (.*) http://www.mydomain.com/?domain=%{HTTP_HOST}
>>
>>
> Ok, but is it possible to extend these rule sets so that It can also
> work with other domains too ? Say by using any variable in RewriteCond
> which can hold the requested domain name and delivered it in the
> RewriteRule
>
> Please let me know if it is possible.
> Thanks
>

No offence meant here, but I see you posting here all the time. This
information is clearly explained in the apache manual, perhaps you may
need to give it another glance, specifically at backreferences?

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

RewriteCond %{HTTP_HOST} (.+)
RewriteRule .* http://foo/?domain=%1

Cheers

Tom

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


Mime
View raw message