Print

Staging Site Redirects to Live Site

If you created a staging site with WP Staging and accessing the staging site redirects you back to the production site you have several options that you can try out first to solve that issue:

Activate post name permalink settings on the staging site

If you are on the staging site and clicking a link redirects you back to the live site try to switch the permalink settings on the staging site and make it identical to the permalink settings of your production website.

As a default, WP Staging sets the permalink settings to the default plain type so switching this setting will often resolve any link redirect issues.

Use absolute URL’s instead relative ones

Check out the structure of a link that redirects back to the production website.

WP Staging cannot search & replace over relative links, so it will need absolute links on your site to be able to do an automatic search & replace through it.

So, for instance:​

Working link: https://domain.com/path-to-page
Not working link: /path-to-page

​To resolve it you have three options:

  • A. Create a new staging site and use a subdomain for it. Then, relative links have no negative side effects and will work as intended.
  • B. Use absolute URLs, instead of relative links.
    Convert all relative links​ to absolute ones. Do this first on the live site and then clone again or change the links on the staging site after creating the staging site.
  • ​C. Ignore non-working relative links and open the pages from the admin dashboard if you want to edit them.

    The recommended way is either option `A` or `B` as it makes working on the staging site much easier than needing to open all the pages for editing from the admin dashboard.

Remove or edit the .htaccess

When you create a clone of your website into a subfolder, WP Staging removes the .htaccess on the cloned site.

The reason is WordPress uses the .htaccess that is located in the root folder of your production site. If one of your plugins recreates the `.htaccess` file on the staging site it could be that that file overwrites the rewrite rules, resulting in non-working permalinks on the staging site.

If that’s the case, rename the `.htaccess` located in the staging site to something else like `.htaccess-disabled` and try again accessing the staging site. For renaming the file you can use your FTP client, cPanel file manager or you can use a file manager plugin installed on your production site.

Bitnami htaccess settings

If you use WordPress in a Bitnami instance you need to take extra steps.

Post-name permalinks are not supported out of the box on WordPress Bitnami instances due to the reason that Bitnami does not use .htaccess in the root folder of the website. It ignores any .htaccess file there.

Bitnami does not use the default .htaccess file in the root of your website, instead, all the htaccess configurations are added to a file called: /opt/bitnami/apps/APPNAME/conf/htaccess.conf.

So if you want to make permalinks working you will need to modify the htaccess.conf

Go to that file and add the following to it:

<Directory /opt/bitnami/apps/wordpress/htdocs/STAGING>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /STAGING/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /STAGING/index.php [L]
</IfModule>
</Directory>

Rename the word STAGING to the folder name of your staging site.

Another option would be to keep the permalinks on the plain settings, then you do not need to change the htaccess.conf at all.

Clone to a Subdomain

If you are not able to solve the redirection issue you can clone your WordPress website to a subdomain and another folder by using the custom target path and hostname option of WP Staging Pro:

We have written an extensive guide on how to clone your WordPress site to another subdomain:
https://wp-staging.com/docs/create-a-staging-site-clone-wordpress/#Clone_to_a_Subdomain

Use of Language Plugins like WPML or Polylang

If you use a language plugin like Polylang or WPML that adds a language slug to the URL, for instance, https:// example.com/en/page1
you will need to activate the post name permalinks on your staging site.

Otherwise, this could be another reason for a link redirect to live.

Disable Security & Login Plugins on Staging Website

Create a new staging website and disable all these plugins by excluding the plugin folders from the cloning process:

  • Security plugins like Wordfence, iThemes Security, Cerber, WP Spamshield, etc.
  • Caching plugins like W3 Total, WP Rocket, etc.
  • Language plugins like WPML, Polylang (Or activate permalinks on the staging site)
  • Redirection / “Hide my Login” plugins

If you already created a staging website and you retrospective need to disable those security plugins you can disable certain plugins by renaming their plugin folder via FTP or any file manager plugin.

For instance, you can disable the WP Spamshield plugin by renaming the plugin folder stagingsite/wp-content/plugins/wp-spamshield to something else.

Disable Redirect Plugins on the Staging Site

If you use a redirect plugin on your staging site, create a new staging site but exclude this redirect plugin from the cloning process.

Opening FTP and renaming the pocket folder to something else.

Alternatively, you can disable and deactivate the redirect plug-in on your staging site by renaming its plugin folder to something else like plugin-name-disabled.

You find all plugins on the wp-content/plugins/

You can use an FTP client or file manager plug-in installed on your production website.

Does it still redirect you to the production website?

If this does not resolve the issue open a support ticket and we assist you to resolve this login issue.

Updated on September 9, 2020