Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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
Apache 使用GET reqs重写URL_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Apache 使用GET reqs重写URL

Apache 使用GET reqs重写URL,apache,.htaccess,mod-rewrite,url-rewriting,Apache,.htaccess,Mod Rewrite,Url Rewriting,如何配置.htaccess重写规则以适应GET请求 目前,/manager/page转到:?dept=manager&n=page但是,有些页面有额外的GET请求,因此此规则不起作用: RewriteRule ^([A-Za-z]+)/([A-Za-z]+)$ index.php?dept=$1&n=$2 [QSA] 我需要:?dept=manager&n=page&id&etc=etc转到:/manager/page/id/5/etc/6但是,并非所有页面都提供相同的id输入方法,即

如何配置.htaccess重写规则以适应GET请求

目前,
/manager/page
转到:
?dept=manager&n=page
但是,有些页面有额外的GET请求,因此此规则不起作用:

RewriteRule ^([A-Za-z]+)/([A-Za-z]+)$ index.php?dept=$1&n=$2 [QSA]
我需要:
?dept=manager&n=page&id&etc=etc
转到:
/manager/page/id/5/etc/6
但是,并非所有页面都提供相同的id输入方法,即一些页面使用id,其他页面使用catid,其他页面使用bugid,所以有点困难

谢谢:)


更新:结束URL-
id/5/etc/6

如果您的输入方法真的如此不同,您应该为每个不同的格式使用多个重写规则。

您只需要指定不同的规则

RewriteCond ${HTTP_METHOD}  "GET"
RewriteRule --your rule--

好吧,他们中的大多数都是id,但是论坛被catid和threadid@ct2k7那么,为catid和threadid添加重写规则,然后为id使用默认规则。它们是什么?花了一个小时想弄明白:/我现在没用了:/不过我该怎么写规则呢?