Results 1 to 6 of 6

Thread: Domain & Sub Domain Config

  1. #1
    New user
    Join Date
    03-30-16.
    Posts
    4

    Default Domain & Sub Domain Config

    Hi,
    My web designer has gone bust and left me with a slightly old looking site on Contao 2.11.9. I have a live site and a sub folder "Demo" which I would like to use for testing an upgrade to Contao. Somewhere down the line I copied some of the live data to the demo directory in order to keep them a little in sync. The problem I have is that although the url to the demo site looks ok it seems to be reading the live data and anything I change affects both the live and demo site which would suggest that the Demo contao is actually pointing to the live directory. I have read quite a lot on the subject but nothing I try seems to work. As far as I can tell there are 3 ways of pointing to the sub directory of /demo. Either .htaccess, localconfig.php and through the control panel pointing to the sub-domain. The url format for the demo site is "demo.mysite.co.uk" and the folder is public_html/demo.
    Any advice to get thins pointing in the right direction would be much appreciated.

  2. #2
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    You should stop doing what you do right now. Make a backup of your files and your database (db dump with e.g phpmyadmin).

    Your live site should reside in ROOT/live/ and the new one in ROOT/new/ (or demo).

    Now your domains (subdomains) should point to those folders. Redirect them in your server account.

    Then on both domains you should run (mysubdomain.)mydomain.tld/contao/install.php. There you now have to set the correct DB connection. You have to use another DB with the new installation. You can not use the same DB on different installations.

    Also don't forget to always use the appropriate .htaccess that comes with the version within every installation ROOT. (.htaccessdefault)

    If you do not know Contao you have to read the tutorials about updating Contao 2 to 3. Or ask a pro.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  3. #3
    New user
    Join Date
    03-30-16.
    Posts
    4

    Default

    Quote Originally Posted by Andreas View Post
    You should stop doing what you do right now. Make a backup of your files and your database (db dump with e.g phpmyadmin).

    Your live site should reside in ROOT/live/ and the new one in ROOT/new/ (or demo).

    Now your domains (subdomains) should point to those folders. Redirect them in your server account.

    Then on both domains you should run (mysubdomain.)mydomain.tld/contao/install.php. There you now have to set the correct DB connection. You have to use another DB with the new installation. You can not use the same DB on different installations.

    Also don't forget to always use the appropriate .htaccess that comes with the version within every installation ROOT. (.htaccessdefault)

    If you do not know Contao you have to read the tutorials about updating Contao 2 to 3. Or ask a pro.
    Hi Andreas,
    Many thanks for your info. I have made a full backup but thanks for the warning. Two databases are already set up. Live site is OK. It is the demo site I have messed I think by copying data from the live directory down to the demo. As you suggest I think I will have to run install.php on the demo site. I am just confused as to what file I have changed to make the installation not work. Everything I do on the demo is reflected in the live site even though I am logging into the Contao admin through mysite/demo/contao. The only thing I can think of is the rewrite in the live .htaccess in the root file which reads:

    RewriteCond %{HTTP_HOST} ^mysite.co.uk [NC]
    RewriteRule (.*) http://www.mysite.co.uk/$1 [R=301,L]

    Do you think this may redirect demo.mysite.co.uk to mysite.co.uk?

    Thanks again for your help.

    Kind regards.
    Last edited by Halfhand; 04/01/2016 at 20:40.

  4. #4
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    No, this should not happen. ^mysite.co.uk means that when the host beginns with "mysite", then it should redirect, but your host on the demo begins with "demo.mysite.co.uk". But anyway you should remove that in your demo and use the original .htaccess build from .htaccessdefault that comes with your Contao version. You can manage the rewrite from www to without www or other way round later in your hosting account or within the .htaccess.

    If the two installations reflects each other, than you are working on the same DB. DB settings are saved in file /system/config/localconfig.php.

    Everytime you click save within Contao, something is written to the DB with two exceptions: In BE System-Settings those values are saved to the localconfig.php and settings you made whithin install tool also are saved to the localconfig.php.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  5. #5
    New user
    Join Date
    03-30-16.
    Posts
    4

    Default

    Hey Andreas,
    You were right in your comment regarding the live and demo systems using the same databases. When I again checked localconfig.php in /demo/system the file was pointing to was to the live database rather than demo. I feel quite small at the moment for making such a silly mistake. Sometimes you check things again and again but don't always see what you are looking for . Thank you for your time and help. Some of the advice you gave me will help me in the future when I mess things up again but hopefully only on the demo system! I cant wait to try upgrading the demo to contao 3.5 and maybe the successor to the catalog module "metamodels". I have seen some wonderful sites developed around Contao and look forward to enhancing my own site with some of the new tools available.
    Vielen Dank Andreas

  6. #6
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    Welcome
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •