0

I have two wordpress installations - each in their own directory - on my one main domain. like mydomain.com/site1 and mydomain.com/site2

By default when visiting mydomain.com it redirects to mydomain.com/site1

I am unsure where this redirect is coming from. There is no .htaccess file in the root of the main domain mydomain.com nor any Index.php file in the root of the main domain.

I have also checked both .htaccess files of each directory installation mydomain.com/site1 and mydomain.com/site2 and do not seem to find what is causing the main domain mydomain.com to redirect to mydomain.com/site1

My main goal is to change the main domain mydomain.com to redirect to mydomain.com/site2 by default

The contents of each .htaccess are as follows:

Site 1 .htaccess

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

# END WordPress
# BEGIN wtfdivi
# END wtfdivi

Site 2 .htaccess

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

# END WordPress
# BEGIN wtfdivi
# END wtfdivi

The contents of both directories Index.php (mydomain.com/site1 and mydomain.com/site2 )are identical as follows

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
2
  • is your site is live? Did you set those url from settings? Commented Oct 18, 2018 at 9:03
  • @Md.AbuZaman - Yes both sites are live, and the url is set in WP settings on each to mydomain.com/site1 and mydomain.com/site2 Commented Oct 18, 2018 at 9:07

1 Answer 1

1

So, Now you can set your redirect url from phpmyadmin.

  1. Go to your database and find the wp_options table.

  2. Now edit the siteurl column and set your domain url here you want to reditect.

  3. Then edit the 2nd column home for your home page and set the same url.

Please clear the cache or press Ctrl+Shift+R or check it from the new incoming window.

Sign up to request clarification or add additional context in comments.

9 Comments

Do I edit the database for mydomain.com/site1 or mydomain.com/site2
you wrote that you want mydomain.com to redirect to mydomain.com/site2 by default so go to mydomain.com/site1 and set mydomain.com/site2
Thank you. I see 'siteurl' but do not have the column 'home'
first column is siteurl and 2nd column is home.
If your problem is solved please mark it as correct answers.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.