Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Could someone tell me how / why is this redirect not working?

$HTTP["host"] =~ ".*\\.mydomain\\.com" { 
    url.redirect = ( 
        "/index\.php\?pg=mysql" => "http://mydomain.com/lean-webhosting/mysql-clustering/",
        "/index\.php\?pg=cloud_uitleg" => "http://mydomain.com/lean-webhosting/cloud-uitleg/" 
    )    
}

Someone any idea? THanks!

share|improve this question

2 Answers 2

You probably need to replace ".*\\.mydomain\\.com" with ".*\.mydomain\.com" and restart lighttpd. If that doesn't help: please explain how the redirect isn't working for you.

share|improve this answer
    
Thaks for the regexp Asgar. That was indeed one of the problems. I've excluded the index.php part and it worked. –  val0x00ff Sep 5 '12 at 13:45
up vote 0 down vote accepted
$HTTP["host"] =~ ".*\.muntinternet\.nl" { 
    url.redirect = ( 
        "/\?pg=mysql" => "http://muntinternet.nl/lean-webhosting/mysql-clustering/",
        "/\?pg=cloud_uitleg" => "http://muntinternet.nl/lean-webhosting/cloud-uitleg/" 
    )    
}

I needed to exclude /index\.php

Thanks!

share|improve this answer
    
Do not forget to accept your answer then. Btw, in the future, add more information in your question instead of just the configuration lines that doesn't work. It would have been interesting here to see which real url you want to redirect to where. –  j0k Sep 5 '12 at 13:59
    
hi j0k. I just added real links to illustrate the situation. Thanks for letting me know to accept the answer as solved. It won't let me untill tomorrow. –  val0x00ff Sep 5 '12 at 14:13
    
Well, I do not want to see real path to your website :) You still can use example.com. But, here we need a real example of url you want to redirect. For example, http://example.com/?pg=mysql So it will be easy to see that your redirect won't work if the rule start with index.php, you see? –  j0k Sep 5 '12 at 14:15
    
There is no muntinternet.nl/?pg=mysql. There is muntinternet.nl/index.php?pg=mysql however non of these should be used if redirecting these two specific urls. THe same example as you can see above is used within lighttpd.conf. –  val0x00ff Sep 5 '12 at 14:25
    
I think you should remove the first / from "/\?pg=mysql" (and the other line too) then, both muntinternet.nl/index.php?pg=mysql & muntinternet.nl/?pg=mysql will be redirected –  j0k Sep 5 '12 at 14:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.