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

  • Home
  • SEARCH
  • 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 986025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:15:17+00:00 2026-05-16T05:15:17+00:00

I am building a portal which will have different cities content.. When someone comes

  • 0

I am building a portal which will have different cities content..

When someone comes to the website i want them to choose the city and then proceed

to

http://city1.site.com

or

http://city2.site.com

can this be done using a single database and installation of cakephp ?

  • 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-05-16T05:15:17+00:00Added an answer on May 16, 2026 at 5:15 am

    Yes it’s possible.

    Basically in your DNS you have to allow *.site.com to be hosted on a single machine.
    This way, no matter what subdomain you type the machine will be the same.

    an example dns record:

    *   A   10.0.0.1
    

    Then in the virtual host declaration you have to put

    <VirtualHost *>
            DocumentRoot /var/www/path_to_site
            ServerName site.com
            ServerAlias www.site.com *.site.com
    </VirtualHost>
    

    this way no matter what you type i.e. something.site.com or city.site.com will be redirected to a single app.

    Then you have just to parse the host from the php (preferably in AppController) and to transform the subdomain to filter.

    It’s a little bit abstract, but that’s how I would do it.

    Edit (response to the comment):
    It’s a matter of how it is build the system. Basically if yo have:

    cite1.site.com
    

    in your AppController you can have something like:

    class AppController extends Controller {
      function beforeFilter(){
         $host = explode('.', $_SERVER["HTTP_HOST"]);
         $subdomain = $host[0];
         Configure::write('city', $subdomain);
         $this->City->getId($subdomain); //function in City model fetching City ID by city name
         ...
      }
    }
    

    So basically, after this it depends what is your application architecture and how you deal with this city.

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

Sidebar

Related Questions

I'm building a java portlet (JSR-168) application and want to define settings, which only
I received a request from my users that they want is a common portal
geocode, only allow enter of specify location example like 'building name' , 'city' ..etc
Building on this question , now I have another problem. Given this, shipments =
I have an folder in my apache public folder and it's contents must be
Building my solution succeeds, but the build fails upon copying from the build to
I observed that generally all good CMS, forums and portals are written in PHP
This is supposed to be a working project from my friend. He demonstrated the
Geocoder getFromLocationName is not returning anything if I'm searching for business places. Here are
that way I am updating ALL properties of the Pupil entity. How can I

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.