Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8621367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:48:17+00:00 2026-06-12T06:48:17+00:00

I am working on classified site. I am using PHP and MySql for that.

  • 0

I am working on classified site. I am using PHP and MySql for that.

On my site when user select their city that time i want to change website url like in subdomain style. foreg:-

http://cityname.mywebsitename.com

Only one thing in my mind to implement this is creating sub domains for all cities. But it would be more difficult to manage when your cities goes 50+. You can’t upload again and again same script for multiple domains. I think this is not a good idea to do this. I want to use a single script for that so i can manage it in simple way.

If you have any idea than please share..

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:48:18+00:00Added an answer on June 12, 2026 at 6:48 am

    I say you how i made it:

    1. in DNS add wildcard subdomain record

      *.domain.tld. IN A 1.2.3.4

    2. add wildcard virtualhost

      <VirtualHost 1.2.3.4>
      DocumentRoot /var/www/vhosts/wildcard
      ServerAlias *.domain.tld.
      ServerName domain.tld
      ...
      </VirtualHost >
      
    3. create a .htaccess that redirect all requests to a FrontController (usually index.php)

      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      
    4. parse $_SERVER['HTTP_HOST'] from php to obtain city name and play with your new FrontController (usually index.php)

    i’ve done it on dedicated server or VPS with linux and plesk. With some modifications on the previous basis points, it is possible everywhere;)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a classified listing style website and I'm pretty new to Rails...
Working sample using one Table SELECT t.* FROM ( SELECT TITLE.name, (TITLE.value-TITLE.msp) AS Lower,
I have a classifieds website... Each classified is displayed in a php page called
I am a beginner in web designing (php, mysql). I am creating a classified
I am working with Naive Bayesian classifier over PHP ( http://www.xhtml.net/php/PHPNaiveBayesianFilter ) And there's
Working on a small game using an HTML5 canvas, and javascript. And it's working
Working with an undisclosed API, I found a function that can set the number
Working with MS Access for the first time and coming across a few problems
I'm working on a process that will perform natural language processing (NLP) on one--and
I'm trying to extract the users who ask questions on a classified ad website(

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.