Jump to content

Recommended Posts

I'm trying to display products specific to a geographic location on the website. E.g. If a user selects city1 then my website url should change to city1.mysite.com.

 

So the city1 part is dynamic on user selection. Please let me know how this is to be achieved and if this includes mod-rewrite or subdomains for each location.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/282187-mod_rewrite-with-subdomain/
Share on other sites

Yes, exactly the same concept, there maybe buyers and sellers in each city. Users would get personalized content from the city they select(that's the easy part :)). So the url should change according to their selection.

There are other website examples too like olx.in and quikr.com

Well, basically, you set up your virtualhost to use *.example.com as the domain, then your PHP scripts can look at the HTTP_HOST (the subdomain specifically) to decide the city. Don't actually need URL rewriting for it.

 

So what are you going to do about the 49 different Greenvilles? 29 Springfields? 18 Clevelands?

  • 4 weeks later...

 

Well, basically, you set up your virtualhost to use *.example.com as the domain

 

@oshopindia, do you have any idea what requinix means by saying this?

 

" *.example.com " is not a real sub-domain. It's a pattern. Don't try to create something like that.

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.