I’m currently using htaccess, but it would be better if I could use Yii because it’s more clean (all redirects in one file) and you could do some custom things with the incoming domains (like keep statistics or create a flash message for the user)
Is this possible with Yii? Or is .htaccess still the way to go?
I don’t see much difference in letting the webbrowser parse the .htaccess or php parsing the url rewrites, altough in theory .htaccess will be faster, this seems negligible… and with yii, you would have a lot more flexibility and you can also run it on non-apache servers
I see your point, but I don’t understand why Yii would have to rewrite any css/js. We’re talking about redirects, not rewrites. So Yii is loaded and before any client side code is loaded, it will redirect to the right location.
For now I will leave the rewrites in the .htaccess but I think there are situations where the flexibility of PHP is better suited for the job.
In this particular use case it doesn’t matter if Yii has to rewrite or redirect. It will allways require PHP/Yii for every request. Otherwise you wouldn’t be able to control them. Now taking into account that most clients issue 3 concurrent requests per domain, you are easily tripling your server load (in the best case).
If you really need URL manipulation capabilities above of what Apache provides you, you might want to take a peek at Lighty’s very own mod_magnet.