我有以下htaccess。
是否可以在htaccess中执行if / elseif。示例: 如果http://url.nl/rs/ elseif http://url.nl/rs/admin/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . rs/index.php [L]
RewriteRule . rs/admin/index.php [L]
答案 0 :(得分:2)
是的,有可能:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^url\.nl/rs$ [NC]
RewriteRule . rs/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^url\.nl/rs/admin$ [NC]
RewriteRule . rs/admin/index.php [L]