【问题标题】:htacces URL rewrite redirectionhtaccess URL 重写重定向
【发布时间】: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


    【解决方案1】:

    试试这个:

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^(.+)\.testsite\.com$ [NC]
    RewriteRule ^$ http://testsite.com/api/v2/%1 [L]
    

    【讨论】:

    • 我的 .htaccess 中已经有这些记录: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L]
    猜你喜欢
    • 2013-12-21
    • 2015-03-04
    • 2014-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-28
    • 2016-09-28
    • 2023-03-25
    相关资源
    最近更新 更多