Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何删除与分页和组件参数匹配的选定URL集上的Index.php_Php_.htaccess_Http Status Code 301 - Fatal编程技术网

如何删除与分页和组件参数匹配的选定URL集上的Index.php

如何删除与分页和组件参数匹配的选定URL集上的Index.php,php,.htaccess,http-status-code-301,Php,.htaccess,Http Status Code 301,尽管每套url中都需要index.php。但是,有两个部分将分页页面中的原始url链接到non index.php 但是,由于cms的升级,url集已变得与index.php兼容 这只需要在页面标签和组件仅为com_news/com_toyschemes的页面上完成 原始正确的URL http://www.abc.com/?page=5&&option=com_latestnews&view=list&Itemid=4 http://www.abc.c

尽管每套url中都需要index.php。但是,有两个部分将分页页面中的原始url链接到non index.php

但是,由于cms的升级,url集已变得与index.php兼容 这只需要在页面标签和组件仅为com_news/com_toyschemes的页面上完成

原始正确的URL

   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
不正确的URL-需要将其重定向到原始URL

   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
有人能帮忙吗


编辑-以上url用于说明。上面有100个页面具有这样的分页方式。

将此规则添加到您的
.htaccess
中,我假设它位于您的web根目录
/

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]

显示您的.htaccess…这是joomla创建的基本htaccess。重写需要在上述URL中完成。你有解决这个问题的办法吗!!不过,谢谢拉维,它只在第2页和第5页起作用。它们是为了说明目的而提供的。里面有几百页。如何让它工作@RuchikaModi,只需用
\d+
代替
[25]
来更新规则,使其适用于所有页码。