【发布时间】:2014-04-13 22:52:03
【问题描述】:
我有一个链接:http://testsite.com/api/v2/1 我想将我的浏览器指向:1.testsite.com 并在 .htaccess 中使用重定向将其链接到这个地方:http://testsite.com/api/v2/1
我该怎么做?
【问题讨论】:
标签: .htaccess mod-rewrite rewrite
我有一个链接:http://testsite.com/api/v2/1 我想将我的浏览器指向:1.testsite.com 并在 .htaccess 中使用重定向将其链接到这个地方:http://testsite.com/api/v2/1
我该怎么做?
【问题讨论】:
标签: .htaccess mod-rewrite rewrite
试试这个:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.testsite\.com$ [NC]
RewriteRule ^$ http://testsite.com/api/v2/%1 [L]
【讨论】: