這就是我要的僞代碼實現的目標:如何在.htaccess文件中編寫if - elseif - elseif條件塊?
if server.host equals 'productionsite.com' then
RewriteBase/
else if server.host equals 'stagingsite.com' then
RewriteBase /staging/mysite
else if server.host equals 'localhost' or server.host equals '127.0.0.1' then
Rewrite /dev/mysite
然而,這就是我其實到目前爲止這似乎並不像我期待的工作:
RewriteCond %{HTTP_HOST} =productionsite.com
RewriteBase/
RewriteCond %{HTTP_HOST} =stagingsite.com
RewriteBase /staging/mysite
RewriteCond %{HTTP_HOST} =localhost
RewriteBase /dev/mysite
我明白任何幫助我可以提前獲得。