Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.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/8/.htaccess/6.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
Php 重定向特定URL访问权限_Php_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

Php 重定向特定URL访问权限

Php 重定向特定URL访问权限,php,.htaccess,mod-rewrite,redirect,Php,.htaccess,Mod Rewrite,Redirect,我尝试将此解决方案应用于重定向问题。似乎不起作用。我被难住了 我需要重定向(domain.com/shop/cart.php?m=product\u detail&p=7) 发送至(domain.com/shop/category page/product-page-c23/) 我尝试的代码如下: RewriteEngine On RewriteCond %{QUERY_STRING} (^|&)m=product_detail(&|$) RewriteCond %{QUERY

我尝试将此解决方案应用于重定向问题。似乎不起作用。我被难住了

我需要重定向(domain.com/shop/cart.php?m=product\u detail&p=7) 发送至(domain.com/shop/category page/product-page-c23/)

我尝试的代码如下:

RewriteEngine On

RewriteCond %{QUERY_STRING} (^|&)m=product_detail(&|$)
RewriteCond %{QUERY_STRING} !(^|&)p=7
RewriteRule cart.php /shop/category-page/product-page-c23/

我真的很感激你给我的建议。非常感谢。我给你买杯啤酒。

你的代码中有一些小错误。请在.htaccess中尝试此代码:

Options -MultiViews +FollowSymLinks
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|&)m=product_detail(&|$) [NC]
RewriteCond %{QUERY_STRING} (^|&)p=7(&|$) [NC]
RewriteRule ^shop/cart\.php/?$ /shop/category-page/product-page-c23/ [NC,L]