例如:
Route::get('/get', function() {
return 'get';
});
要查看路线上面,我必须导航到公共/ index.php文件/搞定了。
To view the route above, I must navigate to public/index.php/get.
我已经看到了不少SO岗位,一派各地尝试不同的东西,也没有了变化(是的,我重启apache每次)。
I've viewed quite a few SO posts and googled around trying different things and it hasn't made a difference (yes I restart apache every time).
下面是我在公共目录中的.htaccess:
Here is my .htaccess in the public directory:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
什么能仍然造成的?我运行Ubuntu。
What could be causing this still? I'm running Ubuntu.
您已经安装了mod_rewrite和Apache的启用?尝试删除的,如果行(和),看看它是否在尝试下载该网站抛出一个错误。如果是这样,运行须藤a2enmod重写
键,重新启动Apache。
Do you have mod_rewrite installed and enabled on apache? Try to remove the if lines ( and ) and see if it throws an error when you try to load the website. If it does, run sudo a2enmod rewrite
and restart apache.
这是我的.htaccess有我的公开/目录:
This is the .htaccess I have on my public/ directory:
<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>