mod_rewrite - 从子域到文档根目录中的文件

时间:2011-05-14 19:30:28

标签: apache mod-rewrite vhosts

我有一个这样的传入网址:

http://api.example.com/get/user/12345/posts?limit=10&offset=0&order=desc&record=type,date

我需要将它重写为(伪代码)

[DocumentRoot]/dispatch.php?url=http://api.example.com/get/user/12345/posts?limit=10&offset=0&order=desc&record=type,date

完全不熟悉,所以最好的情况是你可以给我整个 = VirtualHost = 块。

THX

1 个答案:

答案 0 :(得分:0)

RewriteEngine on
RewriteRule ^(.*)/(.*)/(.*)/(.*)$ [DocumentRoot]/dispatch.php/$1/$2/$3/$4 [L,QSA]
对于htaccess文件(mod重写),你可以据我所知直接添加到你的vhost(但是阅读如何做)

相关问题