Announcement

Collapse
No announcement yet.

Create a copy of a live forum and access it through a subdomain

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] Create a copy of a live forum and access it through a subdomain

    Hi

    I created a copy of my live Forum (vb 4.2.3). I simply copied the whole folde /html/forum/* into /html/forum_test/
    I created a subdomain (test.myforum.com) to point to /html/forum_test/
    I also copied the database from db_live to db_test

    I altered the config.php to point to db_test

    When going to test.myforum.com, the copy of my forum is loaded. The same is true for calling the admincp page.
    BUT: I cannot not log in! Neither as a user nor into the admincp. Checks versus the database are done correctly but I then get redirected to forum's start page or the adminCP start page respectively.

    I know that actually I should go to the adminCP to key in the new URL, etc.
    But without access to the adminCP...

    I have access to the database and full access to the FTP server via SSH.

    What do I need to adjust in order to have a fully functional copy of my forum?
    Last edited by enduroforum; Mon 29th Jan '18, 10:37am.

  • #2
    First of all close your live forum then do the following:-
    • Do a dump of the live database, this will only be needed if the next steps go horribly wrong.
    • Change the URL to the location of the copy forum here - AdminCP > Settings > Options > Site Name/URL/Contact Details > Forum URL
    • Next change the Cookie location to the location of the copy forum here - AdminCP > Settings > Options > Cookies and HTTP Header Options > Path to Save Cookies > Custom Setting.
    • NOW DO NOT CLOSE THIS WINDOW.
    • Then do a dump of the database.
    • Now change the settings back to your live forum settings in the above locations.
    • Now reopen your live site so it can continue running.
    Once you have done the above just import the newly created dump of your live database (with the amended settings) into your copy database and all will work fine.

    Comment


    • #3
      Thanks for your reply.
      Believe it or not but I almost figured that would be the solution.
      Will do exactly as you described it. Thanks.

      When I migrated from vb3 to vb4, I had 3 versions of the forum running in parallel (1 x test and 1x UAT, 1 x preProd). I am almost sure that I did not apply the steps you describe above. Strange...
      Anyways: Thanks! :-)

      Comment


      • #4
        Unfortunately, this did not work.
        My live forum is located at www.domain.com/forum while my copy is located in www.domain.com/forum_test
        Thus, I set "Path to Save Cookies > Custom Setting" as follows:
        live: /forum/
        test: /forum_test/

        Using webDev debug tools, I could see that no cookies are set when custom settings for the cookie path are set.

        By the way: "Cookies and HTTP Header Options > Cookie-Domain" is empty.

        Comment


        • #5
          You shouldn't actually need any of the cookie settings in the admincp, as long as the cookie prefix in BOTH config files are set to different values from the live site. However the values must be the same in both files on each specific site.

          So, the live site could have both config files set to 'bb' and the test site could have both config files set to 'bb2'.

          This will work for most setups.
          MARK.B | vBULLETIN SUPPORT

          TalkNewsUK - My vBulletin 5.4.2 Demo - FEATURING "ROUTE BY NODE"!
          AdminAmmo - My Cloud Demo

          Comment


          • #6
            When you say BOTH, are you implying that I have to adjust 4 files: 2 files within /forum and 2 files within /forum_test? I scanned through all files: The word cookieprefix is used within config.php and class_core.php.
            I have a static subdomain pointing to /forum and I believe this is causing the trouble. because here is what I noticed:
            - Even when debugging the cookie allocation of www.domain.com/forum_test, I noticed that the cookieprefix set within the confg.php of /forum is used.

            I will continue analyzing how the static subdomain was setup. Will let you know the outcome.

            Edit:
            Problem solved:
            I forgot to mention that I had created a subdomain for accessing the copy of my forum: test.mydomain.com which points to /forum_test
            After setting the Cookie Domain to .test.mydomain.com AND adjusting config.php and class_core.php, I am able to logon to the live version of my forum and the copy of it.
            Last edited by enduroforum; Wed 31st Jan '18, 1:19am.

            Comment


            • #7
              Well done, glad you got it sorted.
              I donít think I have ever made changes to class_core.php during my time with vB.

              Comment


              • #8
                Originally posted by enduroforum View Post
                When you say BOTH, are you implying that I have to adjust 4 files: 2 files within /forum and 2 files within /forum_test? I scanned through all files: The word cookieprefix is used within config.php and class_core.php.
                I have a static subdomain pointing to /forum and I believe this is causing the trouble. because here is what I noticed:
                - Even when debugging the cookie allocation of www.domain.com/forum_test, I noticed that the cookieprefix set within the confg.php of /forum is used.

                I will continue analyzing how the static subdomain was setup. Will let you know the outcome.

                Edit:
                Problem solved:
                I forgot to mention that I had created a subdomain for accessing the copy of my forum: test.mydomain.com which points to /forum_test
                After setting the Cookie Domain to .test.mydomain.com AND adjusting config.php and class_core.php, I am able to logon to the live version of my forum and the copy of it.
                You should *absolutely not* be editing class_core.php. You are quite likely to break something unexpectedly by doing that.
                MARK.B | vBULLETIN SUPPORT

                TalkNewsUK - My vBulletin 5.4.2 Demo - FEATURING "ROUTE BY NODE"!
                AdminAmmo - My Cloud Demo

                Comment


                • #9
                  OK, but were you referring to when saying "BOTH config files are set to different values from the live site"?

                  Even if I edit the cookie prefix, class_core.php can stay as is?
                  define('COOKIE_PREFIX', (empty($this->config['Misc']['cookieprefix']) ? 'bb' : $this->config['Misc']['cookieprefix']) . '_');

                  If I change the prefix from bb to tt in the config.php should I adjust core_class.php accordingly?

                  Comment


                  • #10
                    Sorry, vB4 it's just one config file..../includes/config.php.
                    This has a cookie prefix setting which must be different on the live site to the test site.

                    What you have to watch is that if you ever upgrade the test site to vB5, that has TWO config files, and the cookie prefix in both must match (but must still be different from the live site). However if you're testing with vB4 and not planning any vB5 work this won't be an issue.

                    Either way, please do not edit any other files.
                    MARK.B | vBULLETIN SUPPORT

                    TalkNewsUK - My vBulletin 5.4.2 Demo - FEATURING "ROUTE BY NODE"!
                    AdminAmmo - My Cloud Demo

                    Comment


                    • #11
                      I have just checked and I didn't alter anything regarding cookie paths in my config.php

                      I just did what I mentioned in post #2 and made the below changes to the config.php of the test site:-
                      Line 30 $config['Database']['testdb']
                      Line 47 $config['MasterServer']['username'] = 'testuser';

                      Line 48 $config['MasterServer']['password'] = 'testpass';
                      Line 108 $config['Misc']['forumpath'] = '/home/domain/public_html/testsite';

                      Comment


                      • #12
                        Those are not cookie settings, and please don't mix up cookie path and cookie prefix. I'm talking about cookie prefix here.

                        PHP Code:
                            //    Prefix that all vBulletin cookies will have
                            //    Keep this short and only use numbers and letters, i.e. 1-9 and a-Z
                        $config['Misc']['cookieprefix'] = 'bb'

                        For your test installation, this should be changed to something else, eg bb2.
                        MARK.B | vBULLETIN SUPPORT

                        TalkNewsUK - My vBulletin 5.4.2 Demo - FEATURING "ROUTE BY NODE"!
                        AdminAmmo - My Cloud Demo

                        Comment


                        • #13
                          I realise those are not cookie settings, but thanks for the reply Mark.

                          Both my live and test site are the same, the cookieprefix is vb in both config.php files and it seems to work fine.

                          It is only ever myself that uses the test site and I haven't noticed any problems while doing so.

                          Comment

                          Working...
                          X