【问题标题】:how to stop site showing index.php in the URL如何停止在 URL 中显示 index.php 的网站
【发布时间】:2016-10-31 18:51:06
【问题描述】:

我的网站同时解决了这两个问题:

https://www.itcontractorsuk.comhttps://www.itcontractorsuk.com/index.php

我该怎么做才能使额外的 index.php 不显示在 URL 中。它只发生在主页上。

【问题讨论】:

标签: php .htaccess https url-redirection


【解决方案1】:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]

应该做的伎俩。

把它放在你的 .htaccess 中

【讨论】:

  • 这确实做了重定向。没有上述解决方案的替代方案。没有上述代码,内页工作正常。我想要一些主页解决方案。
  • 这是 AFAIK 唯一干净的方法。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-26
  • 1970-01-01
  • 2010-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多