WordPress site in subdirectory load site in main directory

I have two wordpress site one in main directory (public_html) and another one is in subdirectory staging. I already configure all the settings in subdirectory site with http://example.com/staging but when I load http://example.com/staging it redirect to Page Not Found in main site and not in staging site. I set the .htaccess file in staging subdirectory like this.

# BEGIN WordPress
<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>

# END WordPress

And this in on the main site in main directory.

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

# END WordPress

Anybody can help me with this issue and my staging site can load properly ? Thank you before.

1 Answer
1

There are some things you can try:

  • Check the wp-options table in your staging site database and look for
    site URL in 2 places. Change it to the correct staging address if already not.
  • Refresh the permalinks of the staging site.

I am guessing this should fix your problem. If not, please share your website address.

P.S. If both the sites (main and stage) have the same content, you might wanna add a robots.txt file in the staging instance just to be safe from being considered as duplicate content.

Leave a Comment