小黑帽子 2019-03-07 17:07 采纳率: 50%
浏览 1027
已采纳

php如果让/index.php后面所有的链接都返回到首页?伪静态规则问题

http://demo.phpmywind.com/index.php/common/productdetail/id/12.html

这个链接本来应该是不存在的,但是做网站的时候百度偏偏收录了这个链接,怎么让/index.php/common/productdetail/id/12.html这样的链接直接是打开的是首页啊?
/common/productdetail/id/ 都是不存在的目录,只有在index.php/后面加不存在的目录都能打开乱的页面,比如:http://demo.phpmywind.com/index.php/c000/
这个是伪静态规则写的问题吗?
伪静态规则附上:
.htaccess文件如下:

# 将 RewriteEngine 模式打开
RewriteEngine On

# 修改以下语句中的 / 改为您的系统目录地址,如果程序放在根目录中则无需修改
RewriteBase /

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^index.html$ index.php
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^about-([0-9]+)-([0-9]+)\.html$ about.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^news-([0-9]+)-([0-9]+)\.html$ news.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^newsshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ newsshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^product-([0-9]+)-([0-9]+)\.html$ product.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^productshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ productshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^case-([0-9]+)-([0-9]+)\.html$ case.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^caseshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ caseshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^join-([0-9]+)\.html$ join.php?page=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^joinshow-([0-9]+)\.html$ joinshow.php?id=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^message-([0-9]+)\.html$ message.php?page=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^contact-([0-9]+)-([0-9]+)\.html$ contact.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^soft-([0-9]+)-([0-9]+)\.html$ soft.php?cid=$1&page=$2
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^softshow-([0-9]+)-([0-9]+)-([0-9]+)\.html$ softshow.php?cid=$1&id=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^goods-([0-9]+)-([0-9]+)-([0-9]+)\.html$ goods.php?cid=$1&tid=$2&page=$3
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^goodsshow-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ goodsshow.php?cid=$1&tid=$2&id=$3&page=$4
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^vote-([0-9]+)\.html$ vote.php?id=$1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(\w+)\.html$ $1.php?
  • 写回答

1条回答 默认 最新

  • 听楼一夜雨 2019-03-07 17:11
    关注

    你的首页链接写的是index.php,导致收录的其他页面的首页出现相对目录,最好在路径前面加个/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已采纳回答 8月10日

悬赏问题

  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿