Jump to content

Recommended Posts

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

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;

}

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.