[BlueOnyx:06132] Re: wildcard domains and mod_rewrite

Titus Bolton titus at antennasystems.com
Wed Dec 15 17:00:37 -05 2010


You might want to try using some [OR] statements (or use the RegEx or'ing) to get a "switch" styled conditional going inside there.  That way you could test for (\.co\.uk | \.me\.uk), etc.  I think you'd just have to make sure that you're looking to see that the users are using something before the .co or .me, so something like..

Rewrite Engine On
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)(\..*)(\.co.uk|me.uk|com|etc)
RewriteCond %2 !^www$ [NC]

You'll have to fiddle with the RewriteRule a bit, and get the rest of the TLDs in there as well, but something like that should work, but that's just off the top of my head.

That should effectively grab all of the subdomains which they may have added, take the TLD, and their host as well.  If that's completely wrong, please disregard it.

Kind regards,

Titus Bolton
Antenna Systems & Solutions, Inc.
931 Albion Avenue
Schaumburg, Illinois 60193-4550
United States of America
Phone: +1-847-584-1000   Fax: +1-847-584-9951
http://www.antennasystems.com
 
GSA Contract Number: GS-35F-0479T        
Electronic Counter Measures, Trap and Trace Devices, and accessories.
 
Watch our network broadcast television interviews on www.youtube.com/antennasystems
  
Confidentiality note:   
This message is the property of Antenna Systems & Solutions, Inc. and contains information which may be privileged or confidential.  It is meant only for the intended recipients and/or their authorized agents.  If you believe you have received this message in error, please notify us immediately by return e-mail and destroy any printed or electronic copies of this message.  Any unauthorized use, dissemination, disclosure, or copying of this message or the information contained in it, is strictly prohibited and may be unlawful.   Thank you for your cooperation.




On Dec 15, 2010, at 3:42 PM, Germano Soru wrote:

> Hi,
>  
> I just had a quick question that I’ve been asking in relevant chat rooms and forums and everyone seams to bicker rather then help…
>  
> I obviously can’t control everyone’s NS settings and sometimes people put wildcards as entries to allow them to create subdomains instantly and then remove them later.
> These removed ones or misspelt subdomains (or anything for that matter) are forwarded to the first subdomain that I created on that ip on the box. I don’t know if people encounter this and have found a solution?
>  
> I tried a mod_rewrite script to allow me to strip out the subdomain, and put “www” infront to the domain the user has entered into the url bar and then forward, but unfrourtunately for my .co.uk/me.uk it removes the uk part
> effectively pointing to a co which is a different tld
>  
> From reading various websites this is what I came up with, but its probably wrong, or badly written
>  
> RewriteEngine On
> RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).(.*)\.(.*)\.(.*) [NC]
> RewriteCond %2 !^www$ [NC]
> RewriteRule ^(.*)$ http://%3.%4/$1 [QSA,L]
>  
> I tried php too but since I don’t program it didn’t end up well
>  
> Any help would be much appreciated
>  
> And on a side note, what does the “Modify SOA” do and does it benefit me, I know it’s a dumb question. I don’t use the DNS functionality on the box (I use the registrars) , as I found it to cause me loads of problems…
>  
>  
> Regards,
>  
>  
> Germano
> 
> -- 
> This message has been scanned for viruses and 
> dangerous content by MailScanner, and is 
> believed to be clean. _______________________________________________
> Blueonyx mailing list
> Blueonyx at blueonyx.it
> http://www.blueonyx.it/mailman/listinfo/blueonyx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20101215/9f3dcc0b/attachment.html>


More information about the Blueonyx mailing list