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!


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.

  • Thaks for the regexp Asgar. That was indeed one of the problems. I've excluded the index.php part and it worked. – Valentin Bajrami Sep 5 '12 at 13:45
$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


  • 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. – Valentin Bajrami 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. – Valentin Bajrami 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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