htaccess的重写规则的子域名

问题描述:

我用codeigniter作为我的主要安装在主域名。我创建了一个子域和一个文件夹,名为活例如: live.domain.com映射到公/直播。然而,在公共我使用codeigniter。

I use codeigniter as my main install on the main domain. I have created a subdomain and a folder called live e.g. live.domain.com maps to public/live . However in public I use codeigniter.

我现在有动态codeigniter网址:

I now have the dynamic codeigniter url:

http://domain.com/api/

这是我想要映射到我的子域:

which I want to map to my subdomain:

https://live.domain.com

于是打算:

https://live.domain.com/api/functioname

将使用脚本:

would be using the script:

http://domain.com/api/apifunctioname

和可能的:

http://domain.com/api/apifunctioname/parameter1/parameter

一切都是那么不需要重定向在同一台服务器上。

Everything is on the same server so no redirects are needed.

任何人有其重写规则使用任何想法?

Anyone have any ideas on which rewrite rules to use?

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^live\.domain\.com [NC]
RewriteRule (.+)$ "http://domain.com/api/$1" [L]

以上的伟大工程作为一个重写,但重定向到 http://domain.com/api/functionname ,而不是我想要的路由;这样当进入:

The above works great as a rewrite but redirects to http://domain.com/api/functionname instead I want it to route; so that when going to:

https://live.domain.com/api/functioname

它停留在此网址,但使用的脚本

It stays at that url but uses the script of

http://domain.com/api/functionname

非常感谢你,

Thank you very much,

如何类似如下:


RewriteEngine On
RewriteCond %{HTTP_HOST} ^live\.domain\.com$ [NC]
RewriteRule (.+)$ "https://domain.com/api/$1" [L,P]