0

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!

2 Answers 2

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.

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

5
  • 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, 2012 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. Sep 5, 2012 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, 2012 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. Sep 5, 2012 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, 2012 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .