kee2ka4 Posted August 13, 2008 Share Posted August 13, 2008 Hello everyone, I need help on implementing the mod rewrite so the database can be queried by the URL name. So for example if the user types in www.site.co.uk it querys the database and only displays results located in UK and for example if the user types www.site.com it displays results located in USA. Can someone please help me on how I can modify the mod rewrite to acheive that. Thanks, Zub Quote Link to comment https://forums.phpfreaks.com/topic/119549-need-help-to-implement-mod-rewrite-by-url/ Share on other sites More sharing options...
ignace Posted August 13, 2008 Share Posted August 13, 2008 you don't need mod_rewrite for this $parts = explode($_SERVER['HTTP_HOST']); $domain = array_pop($parts); switch ($domain) { case 'com': .. break; case 'uk': .. break; default: .. default behavior break; } Quote Link to comment https://forums.phpfreaks.com/topic/119549-need-help-to-implement-mod-rewrite-by-url/#findComment-615887 Share on other sites More sharing options...
kee2ka4 Posted August 14, 2008 Author Share Posted August 14, 2008 Hi, thanks for the reply. I did consider that option at frist but I also need to futher query the database by cities, so if the url is london.site.co.uk it displays results located in london. Sure I can include another case: case 'london': .. break; But I think that will generate a very long switch case statement. I will start off with the switch case method but is there any better way of doing this. Thanks, Zub Quote Link to comment https://forums.phpfreaks.com/topic/119549-need-help-to-implement-mod-rewrite-by-url/#findComment-616227 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.