簡體   English   中英

Laravel 5.1 .htaccess無法正常工作(漂亮的URL)

[英]Laravel 5.1 .htaccess not working (pretty url's)

因此,我嘗試了.htaccess的兩個版本,項目創建中隨附的一個版本以及文檔中的一個版本。 我目前正在使用文檔中的一個:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

我的虛擬主機設置如下:

<VirtualHost *:80>        
        ServerAdmin <my email>
        ServerName projectflyer.<my domain>.com
        DocumentRoot /var/www/html/projects/project-flyer/public
        DirectoryIndex index.php

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

但是,當我轉到projectflyer.mydomain.com/some/route時,我得到了404。有什么想法嗎? 是的,我可以轉到基本網址。

我通過將其添加到我的virtualhost .conf文件中來解決了這個問題:

<Directory /path/to/your/install/public/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

感謝http://laravel.io/forum/09-15-2015-removing-indexphp-from-url-laravel-5116為答案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM