[ic] URL Rewrite for Subdomains - Help?

Thomas J.M. Burton tom at globalfocusdm.com
Thu Mar 31 21:45:26 UTC 2011


On 3/25/2011 10:25 AM, Thomas J.M. Burton wrote:
> Hi everyone,
>
> I'm in the process of setting up a landing page system for one of the 
> IC catalogs we run and am wondering if anyone might be able to give me 
> some advice on creating rewrite rules to route subdomains to the 
> proper landing page.
>
> Firstly, I'm running this catalog using the Apache rewrite rules that 
> take /cgi-bin/catname out of the URL. I have those set up as follows:
>
>   RewriteEngine   On
>   RewriteRule ^$ /cgi-bin/catname/index.html [PT,L]
>   RewriteRule ^/$ /cgi-bin/catname/index.html [PT,L]
>   RewriteRule ^/cgi-bin/.* - [PT,L]
>   RewriteRule ^/images/.* - [PT,L]
>   RewriteRule ^/interchange-5/.* - [PT,L]
>   RewriteRule ^/(.*) /cgi-bin/catname/$1 [PT,L]
>
> Secondly, I have wildcard domains configured in my DNS and Apache 
> configuration for the domain.
>
> Thirdly, the landing pages are already available via URLs such as 
> http://www.mydomain.com/foopage
>
> What I'd like to do is take a request for a subdomain and route it 
> like so:
>
>     Request: http://foopage.mydomain.com
>     Serves up: http://www.mydomain.com/foopage
>
> ... and it would need to keep the http://foo.mydomain.com URL in the 
> browser's address bar. Basically, I want a seamless method of serving 
> up those landing pages at their subdomains that doesn't send any 
> redirect headers.
>
> I hope this makes sense and that someone out there can help.
>
> Thanks in advance,
> Tom
>

Hi again,

I've worked out the rewrite conditions and rules to get this working, 
but now it seems I need to do something within Interchange's 
configuration to enable the wildcard subdomains to work properly with 
the catalog.

I added these lines to my rewrite rules, after the rules listed in my 
first post:

   RewriteCond %{HTTP_HOST} !^www.* [NC]
   RewriteCond %{HTTP_HOST} !^secure.* [NC]
   RewriteCond %{HTTP_HOST} ^([^\.]+)\.mydomain\.com
   RewriteRule ^/(.*) /cgi-bin/snb/%1 [PT,L]


If I go to http://foopage.mydomain.com it displays the catalog's home 
page with the URL as I want it in the address bar.

Can anyone help me what I need to do in Interchange to have the 
subdomains work the way I described in my original post?

Thanks,
Tom


-- 
_______________________________
Global Focus Digital Media, LLC
www.globalfocusdm.com



!DSPAM:4d94f5f6319594687813696!





More information about the interchange-users mailing list