的.htaccess:重写初始输出回子域 [英] .htaccess : Rewriting initial output back into subdomain

查看:215
本文介绍了的.htaccess:重写初始输出回子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下htaccess的。

I have the following htaccess.

Options +FollowSymlinks 
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^(www|m)\.DOMAIN\.com$
RewriteCond %{HTTP_HOST} ^([^\.]+).DOMAIN.com$
RewriteRule ^(.*)$ http://DOMAIN.com/index.php?id=%1 [NC,QSA,L,R=301]

现在的问题是,我虽然工作需要它仍然使用子域名的URL。所以基本上,现在我想改写DOMAIN.com/index.php?id=%1回SUDOMAIN.DOMAIN.com让用户看到他们请求的地址栏上的子域,而不是的 http://domain.com/index.php?id=user

I'ver尝试各种各样的事情,但最后总是带有某种无限循环。请帮忙!

I'ver tried all sorts of things but always end up with some sort of infinite loop. Please help!

我已经有一个通配符子域名设置。与上面显示的htaccess的结合。 该submain不沾,它改写自己变成上图所示的长字符串。但是,我尝试做的是获得url RO保持subdomain.domain.com不幸的是你贴的链接确实peretty大致相同上面我所张贴,并没有真正似乎能够得到子域粘

I already have a wildcard subdomain set up. In conjunction with the htaccess shown above. The submain doesn't stick, it rewrites itself into the long string shown above. But what im trying to do is get the url ro remain subdomain.domain.com unfortunately the link you posted does peretty much the same as what I have posted above, doesn't really seem to be able to get the sub-domain to stick.

任何想法?

推荐答案

不知道,如果你想通了没有,但你的最后一行(我认为)应该是这样的:

Not sure if you figured it out yet, but your last line (I believe) should be this:

RewriteRule ^(.*)$ index.php?id=%1 [NC,QSA,L,R=301]

如果不行试试这个:

RewriteRule (.*) index.php?id=%1 [NC,QSA,L,R=301]

没有专家,但我有子域从其他code我找到工作。希望它能帮助。

No expert but I have subdomains working from some other code I found. Hope it helps.

这篇关于的.htaccess:重写初始输出回子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆