Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/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
在.htaccess中重写规则,将path/X等查询参数重写为script.php?parameter=X_.htaccess - Fatal编程技术网

在.htaccess中重写规则,将path/X等查询参数重写为script.php?parameter=X

在.htaccess中重写规则,将path/X等查询参数重写为script.php?parameter=X,.htaccess,.htaccess,这是我的htaccess代码: RewriteRule ^profiles/([a-zA-Z0-9_-]+)$ index.php?page=profile&c=search&min=$1 [L,NC] 当我要求: profiles/0 我应该怎么做才能得到如下结果: profiles?min=0&max=100 或 您现有的规则已步入正轨。您必须只更改index.php?。。。到配置文件 如果希望只包含数值,请将正则表达式限制为 RewriteRule ^prof

这是我的htaccess代码:

RewriteRule ^profiles/([a-zA-Z0-9_-]+)$ index.php?page=profile&c=search&min=$1 [L,NC]
当我要求:

profiles/0
我应该怎么做才能得到如下结果:

profiles?min=0&max=100


您现有的规则已步入正轨。您必须只更改index.php?。。。到配置文件

如果希望只包含数值,请将正则表达式限制为

RewriteRule ^profiles/([0-9]+)$ profiles?min=$1&max=100 [L,NC]

我真的不知道你在找什么。如果我的编辑没有反映您的意思,只需还原我的更改。这样做行不通。我需要有一个链接在这个方式是什么网址输入到浏览器?那么应该执行什么脚本/URL呢?我不明白你的意思。mod_rewrite/RewriteRule是一种将客户端请求更改为其他请求的工具。我想知道请求的URL是什么客户端/浏览器,以及服务器应该做什么。
RewriteRule ^profiles/([a-zA-Z0-9_-]+)$ profiles?min=$1&max=100 [L,NC]
RewriteRule ^profiles/([0-9]+)$ profiles?min=$1&max=100 [L,NC]