[英]PHP URL Rewrite not Working in laravel
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I tried this code snippet for URL rewrite and it is not working. 我尝试使用此代码段进行URL重写,但它无法正常工作。
According to me your public/.htaccess file should be like: 据我说,您的public / .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]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Also please check that you've enabled mod rewrite in your apache via editing php.ini & httpd.conf file. 另外,请检查您是否已通过编辑php.ini和httpd.conf文件在Apache中启用了mod rewrite。
You can also follow these steps ( Link ) to make your mod_rewrite URLs work 您还可以按照以下步骤( Link )使您的mod_rewrite URL有效
Don't forget to restart the Apache Service after doing this. 完成此操作后,请不要忘记重新启动Apache Service。
sudo apachectl restart // For MacOS
sudo service apache2 restart // For Ubuntu
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.