• Resolved HairLoss57

    (@hairloss57)


    Hi, I installed a second WordPress package alongside my live blog in a separate directory, but when I login to the second package instead of seeing the control panel I see the front page of the live site!

    The live site is installed in myurl.com/wordpress and the dev site is installed in myurl.com/wp.

    • The site url and home url are correct in both setups
    • Both sites use separate databases with different table prefixes, and as yet there is only default content in the dev database
    • There are .htaccess files in both the myurl.com/wp and myurl.com/wordpress directories but none in the root directory.
    • Both sites were installed manually so there should be no server re-directs in play that may have resulted if installed via the control panel
    • Tests have proven that myurl.com/wp/wp-login.php is being used for logon
    • wp-login.php returns the following values
    • DIRECTORY /var/www/vhosts/myurl.com/httpdocs/wp
    • HTTP HOST myurl.com
    • REQUEST URI /wp/wp-login.php
    • NETWORK SITE URL https://myurl.com/wp

    Does anyone have any ideas as why I am being re-directed?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter HairLoss57

    (@hairloss57)

    I should have added that I tried different browsers and cleared cookies and cache but to no avail.

    Hello @hairloss57

    Hope all is well!

    Please update the .htaccess file of the dev site and replace the rules with the below lines

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/wp/
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Where /wp/ is the folder name, wher eteh devlopemtn opy is installed.

    Otherwise, please also try this solution:
    https://geekflare.com/redirect-subfolder-to-root-folder/

    Hope this helps!

    Cheers,
    Nastia

    Thread Starter HairLoss57

    (@hairloss57)

    Hi Nastia,

    Thanks for your prompt reply. I have tried both solutions but unfortunately without success.

    What do you think is happening to cause the redirect to the live site?

    Thanks.

    Thread Starter HairLoss57

    (@hairloss57)

    I think I see the problem. My sites are running on a VPS and each domain has it’s own Apache config file. I see in the config file that there is the line;

    DirectoryIndex /wordpress/index.php

    So I guess whatever calls the domain is going to get shunted into the /wordpress directory of the live site and not the /wp directory of the dev site.

    I will ponder a solution.

    Thread Starter HairLoss57

    (@hairloss57)

    When I change

    DirectoryIndex /wordpress/index.php

    to

    DirectoryIndex index.htm

    I can no longer run the script /wordpress/index.php – you do not have permission..
    Yet I can run /wordpress/hello.php. Both files have exactly the same permissions, owners and group.

    This is probably an apache issue but if anyone here knows the answer I would be grateful to here.

    Thanks.

    Thread Starter HairLoss57

    (@hairloss57)

    OK, it is ugly but I appear to have found a solution.

    In the apache config file;

    DirectoryIndex /wordpress/index.php

    has been changed to

    DirectoryIndex index.htm

    Additional directives were added;

    <Directory /var/www/vhosts/mydomain.com/httpdocs/wp>
    Options +ExecCGI
    DirectoryIndex index.php
    </Directory>

    <Directory /var/www/vhosts/mydomain.com/httpdocs/wordpress>
    Options +ExecCGI
    DirectoryIndex index.php
    </Directory>

    An index.htm document was added to the root directory with a redirect to send live users to /wordpress/index.php

    In the dev site the pretty permalinks had to be set to the default – mydomain.com/wp/?page_id=2

    Live users get directed to the live site when they type in the domain, I can access my development site simply by adding /wp onto the domain.

    I have been able to logon and create a couple of pages and to see these via the web.

    I anyone knows of a tidier solution please let me know but this will do for now.

    Cheers.

    • This reply was modified 6 years, 7 months ago by HairLoss57.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Dev site redirects to live site on login’ is closed to new replies.