laravel路由不起作用(启用重写mod)

时间:2018-03-09 14:54:53

标签: php laravel

如果没有/index.php/,即使启用a2enmod rewrite

,laravel路线也无法正常工作

这是我的vhost(在etc / apache2 / sites-enabled中)

<VirtualHost *:80>
    ServerName localhost/DnD
    ServerAdmin benno@bennonijholt
    DocumentRoot /var/www/html/DnD/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory "/var/www/html/DnD/public">
        Allowoverride All
    </Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

这是我的htaccess文件

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options +FollowSymLinks
    </IfModule>

    RewriteEngine On

    RewriteBase /home/folder/public_folder

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]

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


    ErrorDocument 404 /404-uh-oh.html

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f


    RewriteRule ^ index.php [L]
</IfModule>

我在另一台机器(也是ubuntu 16.04)上安装了另一个laravel,就像这样,它工作得很好。

0 个答案:

没有答案