logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: mod_rewrite and wildcard DNS
Author
Echilon



Joined: 28 May 2007
Posts: 1
Location: England

PostPosted: Mon 28 May '07 15:03    Post subject: mod_rewrite and wildcard DNS Reply with quote

I'm having problems with rewriterule. Ity's always a buit hit and miss, but I can't figure out why it's not working this time. I wan to change from having a load of arguments in the URL to having a directory/subdirectory structure. I have wildcardDNS enabled, and the code below rewrites every subdomain to an argument - eg: http://blah.mydomain.net/ becomes http://mydomain.net/index.php?cal=blah.

Quote:

RewriteCond %{HTTP_HOST} !^(www|images)\.mydomain\.net$
RewriteCond %{HTTP_HOST} !^mydomain\.net$
RewriteCond %{HTTP_HOST} ^([^\.]+)\.mydomain\.net$
RewriteRule (.*) /home/mydomain/index.php?cal=%1


The problem is, I want to pass more paramaters, so http://blah.mydomain.net/rss/ becomes http://mydomain.net/index.php?cal=blah&act=rss. I've tried using another rewrite rule, but I can't get it working. I *think* it should be something like this:

Quote:

RewriteCond %{HTTP_HOST} !^(www|images)\.mydomain\.net$
RewriteCond %{HTTP_HOST} !^mydomain\.net$
RewriteCond %{HTTP_HOST} ^([^\.]+)\.mydomain\.net$
RewriteRule ^rss/?$ /home/mydomain/index.php?cal=%1&act=rss [S,L]
RewriteRule (.*) /home/mydomain/index.php?cal=%1


Could anyone lend a hand?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 07 Jun '07 16:55    Post subject: Reply with quote

I have found some good pages about that.

http://bla.st/site/blog/32/
http://www.techsanctuary.com/node/4
http://forum.dreamhosters.com/programming/78397-mod_rewrite-and-wildcard-dns.htm

Hope that helps!
Back to top


Reply to topic   Topic: mod_rewrite and wildcard DNS View previous topic :: View next topic
Post new topic   Forum Index -> Apache