Jump to content

Mod_rewrite with subdomain


oshopindia

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.