简体   繁体   English

在子目录中将Wordpress安装为插件域,并在url中删除安装文件夹

[英]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. 我已经安装了一个插件域,并在public_html文件夹中创建了一个子目录,在其中为新站点安装了wordpress。 Everything works fine except the I cannot remove the subfolder from the url. 一切正常,除了我无法从URL中删除子文件夹。 I presume chhanging the htaccess file in the addondomain is the problem. 我认为在addondomain中更改htaccess文件是问题所在。

wordpress address url http://addondomain.com/addondomain site url http://addondomain.com WordPress地址url http://addondomain.com/addondomain网站url http://addondomain.com

in index.php in the addondomain folder I changed 在我更改的addondomain文件夹中的index.php中

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

to

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

my htaccess file in the addon directory 我的htaccess文件在addon目录中

<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) 主要public_html目录中的htaccess文件(包含另一个域的文件)

<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. 我想要的只是从URL中删除wordpress安装文件夹,但是我有一个域和子域以及两个wp安装。

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

Remove /addondomain from the last rule in .htaccess file in the addon directory (RewriteBase stays as before). 从addon目录中的.htaccess文件中的最后一条规则中删除/ addondomain(RewriteBase保持与以前相同)。

# 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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