Home >Backend Development >PHP Tutorial >请问一个apache rewrite rule 有关问题

请问一个apache rewrite rule 有关问题

WBOY
WBOYOriginal
2016-06-13 10:36:22871browse

请教一个apache rewrite rule 问题
前些天我仿照一个url rule 写了一个新的url rule 但是 前面匹配上了 .html? 后面的参数没有在url 中 不知道为什么 
原始的url

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->RewriteRule ^/mall(?:\/([a-zA-Z0-9]+)(?:-([a-zA-Z0-9]+)(?:-([a-zA-Z0-9]+)(?:-([a-zA-Z0-9]+))?)?)?(?:-web2_([a-zA-Z0-9]+))?)\.html?$ /rebategoods.php?class=$1&small_class=$2&third_class=$3&fourth_class=$4&website_py=$5&%1


我仿照写的

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->RewriteRule ^/search_(?:[^_]*)(?:\/([a-zA-Z0-9]+)(?:-([a-zA-Z0-9]+)(?:-([a-zA-Z0-9]+)(?:-([a-zA-Z0-9]+))?)?)?(?:-web2_([a-zA-Z0-9]+))?)\.html?$ /search.php?q=$1&class=$2&small_class=$3&third_class=$4&fourth_class=$5&website_py=$6&%1

第一个我打网址

http://buy.2345.com/mall/fuzhuang-nvzhuang-shangyi-txu.html?order=2&minprice=&maxprice=&p=1

参数为
Array ( [class] => fuzhuang [small_class] => nvzhuang [third_class] => shangyi [fourth_class] => txu [website_py] => [order] => 2 [minprice] => [maxprice] => [p] => 1 ) 

我写的网址:

http://buy.2345.com/search_aaa/fuzhuang-nvzhuang-shangyi-txu.html?order=2&minprice=&maxprice=&p=1

但是参数 只有
Array ( [q] => fuzhuang [class] => nvzhuang [small_class] => shangyi [third_class] => txu [fourth_class] => [website_py] => ) 
问号后面的都没有传进来 为什么呢

------解决方案--------------------
lz nb, 膜拜来了
------解决方案--------------------

------解决方案--------------------
这正则写的太长了, 是不是RewriteCond没有把query给C下来。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn