Re: .htaccess redirect issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 27, 2010 at 9:50 AM, J. Bakshi <joydeep@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux