我想运行一个wordpress网站通过一个子目录,但保留实际的领域。
这就是我想要做的。
比方说,我有一个网站www.xyz.com
我在根目录上安装了wordpress实例。但是,我想在子目录中安装一个新的wordpress实例。我想要指向根目录worpdress实例到子目录,并保留域名而不引用子目录。
子目录可以称为"test“。在测试目录中,我将安装一个新的wordpress实例。
现在,我想将www.xyz.com指向"test“目录,并将链接设置为www.xyz.com。所有链接应该是www.xyz.com/post sample,而不是www.xyz.com/test/post sample。
是否需要在.htaccess文件中设置mod重写规则?
任何帮助都是感激的。谢谢!
发布于 2014-07-29 16:31:04
尝试将其添加到.htaccess文件中
.htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line.
RewriteEngine on
# Change yourdomain.co.uk to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.co.uk$
# Change ‘subfolder’ to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/
# Don’t change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change ‘subfolder’ to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1
# Change yourdomain.co.uk to be your main domain again.
# Change ‘subfolder’ to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.co.uk$
RewriteRule ^(/)?$ subfolder/index.php [L]发布于 2014-07-29 16:34:45
如果您已经将这里安装在子目录中,那么就可以在wordpress上使用它了。
require( dirname( __FILE__ ) . '/wp-blog-header.php' );的行改为: WordPress核心文件的目录名:require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
https://stackoverflow.com/questions/25020296
复制相似问题