Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/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
.htaccess 使用with htaccess更改url_.htaccess_Url_Url Rewriting - Fatal编程技术网

.htaccess 使用with htaccess更改url

.htaccess 使用with htaccess更改url,.htaccess,url,url-rewriting,.htaccess,Url,Url Rewriting,我正在尝试使用htaccess重写更改url 我想更改此url page/details.php?name=abcdef&id=18 到 这是我的示例代码 RewriteEngine On RewriteRule ^company/([A-Za-z0-9-]+)/$1 company/details.php?name=$1&id=$2 [R=301,L] 这是不工作,我也尝试了许多代码,但没有工作,请帮助我找到这个网址的htaccess代码 感谢您的支持,这应该可以满足您的要

我正在尝试使用htaccess重写更改url 我想更改此url

page/details.php?name=abcdef&id=18

这是我的示例代码

RewriteEngine On
RewriteRule ^company/([A-Za-z0-9-]+)/$1 company/details.php?name=$1&id=$2 [R=301,L]
这是不工作,我也尝试了许多代码,但没有工作,请帮助我找到这个网址的htaccess代码
感谢您的支持,这应该可以满足您的要求:

RewriteCond %{QUERY_STRING} ^.*name=([a-zA-Z0-9]*).*$
RewriteRule ^page/(.*)$ page/%1? [R=301,L]
试试这个:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=(.*)&id=(.*)$
RewriteRule ^page/(.*)$ /page/%1? [R=301,L]

这将检查查询字符串中的这两个参数。

我的解决方案对您有效吗?
RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=(.*)&id=(.*)$
RewriteRule ^page/(.*)$ /page/%1? [R=301,L]