wordpress子域错误(2 wordpress)

时间:2015-02-17 07:10:59

标签: wordpress .htaccess mod-rewrite rewrite subdomain

所以我在Domain中有一个现有的wordpress,并在域文件夹(domain / subdomain /)中的新文件夹(子域)中安装了一个全新的wordpress。现在我想使用subdomain.domain.com访问这个新的wordpress。能够做到这一点,但后来遇到图像问题。能够解决它,但我现在有一个问题,如wp-blog-header.php等文件。这里有更多细节希望有人能告诉我哪里出错:

.htaccess of Domain

# 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

RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com$
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
RewriteRule ^subdomain/(.*)$ http://subdomain.domain.com/$1

子域的.htacccess为空。

wp-config中的

我有以下内容:

define( 'WP_SITEURL', 'http://subdomain.domain.com' );
define( 'WP_HOME', 'http://domain.com/subdomain' );

当前错误

Warning: require(/clientdata/apache-www/b/o/domain.com/www/subdomain/subdomain/wp-blog-header.php)
[function.require]: failed to open stream: No such file or directory in
/clientdata/apache-www/b/o/domain.com/www/subdomain/index.php on line 17

如您所见,路径中的子域加倍。是什么造成的?

提前致谢!

1 个答案:

答案 0 :(得分:2)

将两个配置变量更改为使用子域。

define( 'WP_HOME', 'http://subdomain.domain.com' );
define( 'WP_SITEURL', 'http://subdomain.domain.com' );

这会使您的.htaccess完全控制,并阻止wordpress在任何地方附加/子域名。