Jam*_*sir 4 php apache .htaccess laravel-routing laravel-5
URL 在我的应用程序中运行良好。我的意思是它们是漂亮的 URL。像http://www.example.com/ 但是当您使用index.php访问页面时它也有效,例如http://www.example.com/index.php,我不想要它,因为它显示两个站点地图中一页的链接。一个页面没有index.php,另一个页面有index.php。站点地图的演示在这里https://www.xml-sitemaps.com/details-eln.6762418.html
这是.htaccess
<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>
Run Code Online (Sandbox Code Playgroud)
输入以下代码:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,7}\s/(.*)index\.php\sHTTP.*$
RewriteRule ^ /%1 [R=301,L]
Run Code Online (Sandbox Code Playgroud)