mod_rewrite and wildcard DNS - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

mod_rewrite and wildcard DNS

EchilonEchilon Posts: 2Member
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 wildcard DNS 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
[/quote]
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
[/quote]
Could anyone lend a hand?

Comments

  • EchilonEchilon Posts: 2Member
    : 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 wildcard DNS enabled, and
    : the code below rewrites every subdomain to an argument - eg:
    : http://blah.mydomain.net/ becomes
    : http://mydomain.net/index.php?cal=blah.
    :
    : : 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:
    :
    : : 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?
    :
    Anyone?
Sign In or Register to comment.