使用域的htaccess的wordpress子域(可能)

约翰·思克

所以我在我的域中有一个wordpress,在子域中有一个wordpress(域内的文件夹)

现在一切都很好,这要归功于stackoverflow上的ravi。唯一剩下的问题是漂亮的永久链接。我似乎无法使用帖子名称,但是当我使用默认名称并添加了index.php时,它可以正常工作。这是我的子域的htaccess:

Options +FollowSymlinks
RewriteEngine on

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

...但是它不起作用。但是,当我尝试将这些代码粘贴到域的htaccess中时,它确实起作用了,这当然破坏了域的永久链接。

所以我想知道如何让我的子域使用它自己的htaccess,或者这真的是我的问题吗?在此先感谢,这里是其他配置。

域的htaccess:

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

# 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

当前的永久链接: http : //subdomain.domain.com/index.php/%postname%/

WordPress地址(URL): http : //subdomain.domain.com网站地址(URL): http : //subdomain.domain.com

尝试将wordpress地址更改为http://domain.com/subdomain,但这无济于事。

拉维(Ravi K Thapliyal)

一旦您的子域规则触发,在您的主域的htaccess中停止重写。

RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/subdomain/ [NC]
RewriteRule ^ /subdomain/$1 [L]

[L]标志这一规则为最后并停止处理您的子域任何更多的规则。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章