【发布时间】:2015-12-13 22:47:49
【问题描述】:
由于我是 laravel 的新手,我已经安装了一个新副本,授予必要的权限并运行应用程序,一切都很好。 现在我已经在 apache 中创建了一个虚拟主机来删除公共,这也可以正常工作:
<VirtualHost *:80>
ServerName mobileapp
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mobileapp/public
<Directory "/var/www/html/mobileapp/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mobileapp_error.log
CustomLog ${APACHE_LOG_DIR}/mobileapp_access.log combined
现在该站点可以通过http://mobileapp/index.php/pages 在本地访问,但如果我从 url (http://mobileapp/pages) 中删除 index.php 将无法正常工作。 我的 .htaccess 文件是:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^ index.php [L] # <----- Tested not working
RewriteRule ^(.*)$ /$1 [L] # <----- neither this one
我还启用了 mode_rewrite。谁能告诉我什么是最好和最简单的骑行方式。
【问题讨论】:
标签: php apache .htaccess mod-rewrite laravel-5