【问题标题】:Laravel 5 mod_rewrite not workingLaravel 5 mod_rewrite 不工作
【发布时间】:2015-05-12 08:13:04
【问题描述】:

/etc/apache2/apache2.conf

<Directory />
        Options FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

<Directory /usr/share>
        AllowOverride All
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

然后在我的 Laravel 公用文件夹中:

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

    RewriteEngine On

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

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

网址: http://sub.domain.se/user/login 不工作。

但是 http://sub.domain.se/index.php/user/login

有效。

写的时候:apachectl -M

rewrite_module(共享)被包括在内

在启用网站时:

<VirtualHost *:80>
        ServerName sub.domain.se
        DocumentRoot /var/www/project/public
</VirtualHost>

我错过了什么?

【问题讨论】:

  • 已经重启你的apache服务器了吗?
  • 是的,我已经尝试重启 Apache 服务器几次了。

标签: php apache .htaccess mod-rewrite


【解决方案1】:

我的工作 .htaccess 文件如下:

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

    Options +FollowSymLinks
    RewriteEngine On

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

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

【讨论】:

    猜你喜欢
    • 2015-09-22
    • 2018-05-16
    • 2018-08-11
    • 2016-01-18
    • 2016-05-15
    • 2017-06-08
    • 2018-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多