如何删除索引.php在选择一组与分页和组件参数匹配的 URL 上


How to remove Index.php on Select set of URLs Matching Pagination and Component Parameter

虽然索引.php在每组URL中都是必需的。但是,在 2 个部分中,我们在分页页面中的原始网址与非索引链接.php

但是,由于 cms 的升级,url 集变成了带有索引.php这只需要在页面标签和组件仅作为com_news/com_toyschemes的页面上完成。

原始正确网址

   http://www.abc.com/?page=5&&option=com_latestnews&view=list&Itemid=4
   http://www.abc.com/?page=2&&option=com_toyschemes&view=list&Itemid=3

不正确的网址 - 需要 301 重定向到原始网址

   http://www.abc.com/index.php?page=5&&option=com_latestnews&view=list&Itemid=4
   http://www.abc.com/index.php?page=2&&option=com_toyschemes&view=list&Itemid=3

有人可以帮忙吗?

编辑 - 上面的网址用于说明。上面有 100 页带有这样的分页。

将此

规则添加到您假设位于您的 Web 根目录中.htaccess /

RewriteCond %{REQUEST_URI} ^/index'.php$ [NC]
RewriteCond %{QUERY_STRING} (^|&)page='d+(&|$) [NC]
RewriteCond %{QUERY_STRING} (^|&)option=com_(latestnews|toyschemes)(&|$) [NC]
RewriteRule ^ /?%{QUERY_STRING} [R=301,L]