如何设置wordpress';子域中的HTS访问
我在godaddy上有一个wordpress网站,其htaccess配置如下:如何设置wordpress';子域中的HTS访问,wordpress,.htaccess,woocommerce,Wordpress,.htaccess,Woocommerce,我在godaddy上有一个wordpress网站,其htaccess配置如下: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /sub-domains/shop/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRul
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub-domains/shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基础/子域/店铺/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
然后,我需要为我们的店铺创建一个子域名,因此我在以下文件夹中创建了一个子域名:/sub-domains/shop。我还安装了另一个wordpress和woocommerce,将永久链接设置为主机名
当我导航到它时,它会正确地呈现,但当我打开一个页面(例如:)时,它会重定向回
然后我创建一个htaccess文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub-domains/shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基础/子域/店铺/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
但什么都没发生?有人知道吗?谢谢。我假设htaccess文件在您的子域“shop”文件夹中?尝试删除规则目标中的前导斜杠:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub-domains/shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基础/子域/店铺/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。index.php[L]
#结束WordPress
原来我的Godaddy的windows共享主机不支持htaccess,而我为IIS创建了一个Web.config(在子域的根文件夹中):
此外,在上述托管中,可以通过在子域的根文件夹中创建另一个文件php5.ini来覆盖php配置。仍然是相同的错误:-(。它重定向到主网站。@czetsuya听起来可能是wordpress配置问题,而不是规则问题
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule></rules>
</rewrite>
</system.webServer>
</configuration>