请教一个url rewrite的写法

WBOY
Release: 2016-06-23 13:56:29
Original
864 people have browsed it

例如有以下url
http://www.domain.com/$version/$controller/$param1/$param2/$param3

其中 $version, $controller 必定存在,$param1~paramN,没有固定数量。

想实现
$version/$controller/$param1/$param2/$param3
rewrite成
$version/$controller .php/$param1/$param2/$param3

例如
/v1.0/member/signup/fdipzone/123456/1
rewrite 为
/v1.0/member.php/signup/fdipzone/123456/1


试过这样写但不行

RewriteRule ^(.*?)/(.*?)/(.*)$ $1/$2.php$3 [L]
Copy after login


望指教,非常感谢。


回复讨论(解决方案)

RewriteRule  ^(.*)/(.*).php/(.*)$ $1/$2.php$3 [L]

RewriteRule  ^(.*)/(.*).php/(.*)$ $1/$2.php$3 [L]


如果需要用户输入.php,那就不需要做这个rewrite动作了。

/v1.0/member/signup/fdipzone/123456/1
rewrite 为
/v1.0/member.php/signup/fdipzone/123456/1

输入是不能带php的。

自己解?了。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template