【发布时间】:2016-09-18 21:37:04
【问题描述】:
我想知道如何从 URL 中删除 index.php,我网站上的每个链接都有 index.php,例如example.com/index.php/contact-us。
我使用 Drupal 8,我的服务器是 Apache,php 版本是 5.6,我在共享主机上。
在我尝试使用的 .htaccess 文件中
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
删除了 index.php,但任何新文章都不会在主页中显示图像(index.php)
然后我尝试使用
RewriteBase /
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
同样的事情发生了。
请指教
【问题讨论】: