mod_rewrite and wildcard DNS

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

  • : 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.

Howdy, Stranger!

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

Categories

In this Discussion