htaccess表达式无法正常工作

时间:2014-05-27 13:54:23

标签: apache apache2.4

我只是在主机名等于" dev.local"时尝试设置RewriteBase,但我的if语句似乎没有工作。

虚拟主机:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName dev.local
    DocumentRoot /var/www-shared

    Alias /frontoffice /var/www-shared/frontoffice-laravel/public

    <Directory /var/www-shared>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

htaccess的:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    <If "%{SERVER_NAME} == 'dev.local'">
        RewriteBase /frontoffice
    </If>

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

0 个答案:

没有答案