My host root looks like:
/
.htaccess
index.php
-wordpress1
--wp-content
--wp-include
--.htaccess
--index.php
--...etc...
-wordpress2
--wp-content
--wp-include
--.htaccess
--index.php
--...etc...
I installed one wordpress first at subdirectory wordpress1 and use main domain point to it.
Now i want add a subdomain like subdomain.domain.com, subdomain is also a directory, point to subdirectory wordpress2, And i can visit it use subdomain.domain.com.
—— 1
my root .htaccess file likeï¼
# 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
And my root index.php
<?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__ ) . '/wordpress1/wp-blog-header.php' );
—— 2
my wordpress1 .htaccess file likeï¼
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress1/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpess1/index.php [L]
</IfModule>
# END WordPress
And my wordpress1 index.php
<?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' );
—– 3
my wordpress2 .htaccess file likeï¼
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress2/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpess2/index.php [L]
</IfModule>
# END WordPress
And my wordpress2 index.php
<?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' );
Now i can use maindmain.com to visit wordpress1, And i can’t use wordpress1.maindomain.com to visit wordpress2, but can use maindomain.com/wordpress2 to visit.
How to change it?
Thanks!