【发布时间】:2016-12-31 12:45:32
【问题描述】:
我有两个条件:
重写为
http://localhost/restexample/RestController.php?phone=single&id=2
和
重定向/重写到
http://localhost/restexample/RestController.php?phone=all&no=12345
我在第一种情况下得到了正确的响应,但在第二种情况下没有。
我的 .htaccess 文件是:
# Turn rewrite engine on
Options +FollowSymlinks
RewriteEngine on
# map neat URL to internal URL
RewriteRule api/con/([0-9]+)/$ "RestController.php?phone=single&id=$1" [nc,qsa]
RewriteCond %{QUERY_STRING} number=(\d+)$
RewriteRule "^api" "RestController.php?phone=all&no=%1" [nc,qsa,R=301]
请有人帮忙。
第二个文件的输出:
【问题讨论】:
标签: php apache .htaccess mod-rewrite localhost