简体   繁体   中英

Install Wordpress in subdirectory as addon domain and remove install folder in url

I have installed an addon domain and created a subdirectory in the public_html folder where I installed wordpress for the new site. Everything works fine except the I cannot remove the subfolder from the url. I presume chhanging the htaccess file in the addondomain is the problem.

wordpress address url http://addondomain.com/addondomain site url http://addondomain.com

in index.php in the addondomain folder I changed

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

to

require( dirname( __FILE__ ) . '/addondomain/wp-blog-header.php' );

my htaccess file in the addon directory

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

The htaccess file in the main public_html directory (contains files of another domain)

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

All I want is to remove the wordpress installation folder from the url, but I have a domain and subdomain and two wp installations.

问题实际上出在附加域的根文件夹中,该目录设置为根目录而不是子目录。

Remove /addondomain from the last rule in .htaccess file in the addon directory (RewriteBase stays as before).

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

# END WordPress

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM