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!

Valentin Bajrami
  • 3,870
  • 1
  • 17
  • 25

2 Answers2

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.

Ansgar Wiechers
  • 4,197
  • 2
  • 17
  • 26
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!

Valentin Bajrami
  • 3,870
  • 1
  • 17
  • 25
  • 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 05 '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 05 '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 05 '12 at 14:15
  • There is no http://muntinternet.nl/?pg=mysql. There is http://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 05 '12 at 14:25
  • I think you should remove the first `/` from `"/\?pg=mysql"` (and the other line too) then, both http://muntinternet.nl/index.php?pg=mysql & http://muntinternet.nl/?pg=mysql will be redirected – j0k Sep 05 '12 at 14:31