.htaccess fun

This website:

http://tips-scripts.com/undefined

Is fucking awesome. I’ve been melting my brain trying to figure out if it’s possible to strip off nonexisting subdomains, and couldn’t get my head around it for the life of me… Turns out the .htaccess file comes in to save the day… again.
I came across this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.([^\.]+\.[^\.]+)$
RewriteCond %1 !^(www)$
RewriteCond %{HTTP_HOST} !^[0-9\.]+$
RewriteRule ^(.*)$ http://%2/$1 [R,L]

And had to repost it just because of it’s pure usefulness, and perhaps it will help someone else out with the same problem.

Not only that but here’s more:
Mod Rewrite Guide
URL Masking
Rewrites

Yet again the simplest solution is always the best… I wish I where more simple-minded.

For Spiders:
truncate subdomain remove subdomain from domain name htaccess subdomain

And something completely random…
If you’re looking to make a little (or a lot of) money on the side, keep an eye on the following:
http://pleaserobme.com/

This monster belongs in Web/Game Dev: Tutorials & Sourcecode. Bookmark the permalink. Follow any flames or other attacks to it with the RSS feed for this abominable creature. Voice your rage or leave a /b/roback: /b/roback URL.

Post a /B/romment

Chill, /b/ro. Your email is probably not, but most likely impossibly going to be not shared. Required fields are marked, yo... *

*
*

Use these /b/ro HTML haxxx: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Beerme: