Laravel 4从URL中删除Index.php
我需要一些关于laravel 4应用程序的帮助我需要从url中删除Index.php我已经尝试了laravel文档中提到的解决方案Laravel 4从URL中删除Index.php,php,laravel-4,pretty-urls,Php,Laravel 4,Pretty Urls,我需要一些关于laravel 4应用程序的帮助我需要从url中删除Index.php我已经尝试了laravel文档中提到的解决方案 Pretty URLs Apache The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enabl
Pretty URLs
Apache
The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.
If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
任何建议:)?默认情况下可能不会启用mod_rewrite apache模块。启用它并重试 试试这个:
a2enmod rewrite
在apache
httpd.conf
“公用”文件夹中的check.htaccess文件(默认创建)
选项-多视图
重新启动发动机
#重定向尾部斜杠。。。
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
我读过很多文章和帖子,但都不管用,然后我发现这个对我来说很管用
最简单的方法(也是我一直使用的方法)是打开命令提示符或终端,然后将cd放入项目的主目录中,然后运行“php artisan serve
”。就这样。你完了。不相信我?签出http://localhost:8000
并欣赏您的Laravel工作
用于LAMP服务器 尝试以下步骤
<Directory "/var/www/html">`
AllowOverride All
</Directory>
`
允许超越所有
CTRL-X,“y”
和ENTER
保存并退出nano编辑器<Directory "/var/www/html">`
AllowOverride All
</Directory>
`
允许超越所有
只要转到您的apache设置文件夹,我使用wamp,所以myne是
C:/wamp/bin/apache/apache2.4.9/conf/httpd.conf-file
// located on line 154 precisely...
#LoadModule rewrite_module modules/mod_rewrite.so
// to
LoadModule rewrite_module modules/mod_rewrite.so
重新启动WAMP和BOOM!。。它可以工作。因此,如果您访问yourwebsite.com/controller/action,它会重定向到yourwebsite.com/index.php/controller/action?是的,它的工作原理与此完全相同您的答案是使用内置开发服务器?这真是个糟糕的建议。这里的用户并没有提到他在生产服务器上。我认为这是在开发模式下使用的最佳选择。是的,您的解决方案工作正常。但如果我想在虚拟主机中运行,即创建一个自定义url,该怎么办?在我的例子中,它已经启用了。但面对同样的问题。运行上述命令时显示:
模块重写已启用
// located on line 154 precisely...
#LoadModule rewrite_module modules/mod_rewrite.so
// to
LoadModule rewrite_module modules/mod_rewrite.so