我的htaccess
文件中包含此代码:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(online-shop)/?$ $1/home [L,NC]
RewriteRule ^(my)/?$ $1/home [L,NC]
RewriteRule ^(blog)/(post|tags)/([\w-]+)/?$ index.php?id=$1&type=$2&unique=$3 [L,QSA,NC]
RewriteRule ^(blog)/(archives)/([0-9]{4})/([0-9]{2})?$ index.php?id=$1&type=$2&year=$3&month=$4 [L,QSA,NC]
RewriteRule ^([\w/-]+)/?$ index.php?id=$1 [L,QSA]
它会停止域工作的子域并显示404页面错误,因为它找不到index.php
如何修复子域?
答案 0 :(得分:1)
您需要在条件中检查您的域名,以便它仅适用于您的主域名。将example.com替换为您的域名。
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule ^([\w/-]+)/?$ index.php?id=$1 [L,QSA]