更新:所有RewriteCond域都通过第二个默认的RewriteRule,而不是去他们自己的RewriteCond,然后是RewriteRule。我转到的所有网址都默认为/template/home.php。我知道你可以在一个.htaccess中放入多个域,但是我无法将这个.htaccess用于将不同的域引导到它们的默认路径。这让我摸不着头脑。
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (.[^\.]+)(.+)(firstDomain)(\..+) [NC]
RewriteRule .* - [E=SLUG:%1,E=DOMAIN:%{HTTP_HOST}]
RewriteRule ^/?$ /template/home.php [NC,L,QSA]
RewriteCond %{HTTP_HOST} (.[^\.]+)\.on\.(secondDomain)(\..+) [NC]
RewriteRule .* - [E=SLUG:%1,E=DOMAIN:%{HTTP_HOST}]
RewriteRule ^/?$ /template/landing.php [NC,L,QSA]
答案 0 :(得分:0)
当你否定这样的第一个条件时会发生什么:
def getNumberOfBlocks(px):
di = GetDataInformation()
cdi = di.GetCompositeDataInformation()
return cdi.GetNumberOfChildren()
答案 1 :(得分:0)
RewriteCond
仅适用于下一个RewriteRule
。所以你需要:
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (.[^\.]+)(.+)(firstDomain)(\..+) [NC]
RewriteRule ^ - [E=SLUG:%1,E=DOMAIN:%{HTTP_HOST}]
RewriteCond %{HTTP_HOST} firstDomain\. [NC]
RewriteRule ^/?$ template/home.php [L]
RewriteCond %{HTTP_HOST} (.[^\.]+)\.on\.(secondDomain)(\..+) [NC]
RewriteRule ^ - [E=SLUG:%1,E=DOMAIN:%{HTTP_HOST}]
RewriteCond %{HTTP_HOST} secondDomain\. [NC]
RewriteRule ^/?$ template/landing.php [L]