子域重写规则将 URL 参数传输到其他目录?
我的问题:我想要一个 rewriteRule,允许我将参数转发到服务器上的另一个目录。我调用了我的页面的子域,该子域应该指向我的根页面的“正常”目录。除此之外,规则还应该向所有将被调用的 url 添加一个参数。
示例:
Root-Page: http://www.example.com -> directory on the server /srv/www/vhosts/example.com/httpdocs/
Subdomain: http://fb.example.come
现在根页面和子域应该指向同一目录:
子域 ->服务器上的目录 /srv/www/vhosts/example.com/httpdocs/
两个域之间的区别是应添加到每个 URL 调用的参数:
User-Call: http://fb.example.com/index.php
--> add a fb=1 param
Intern -> http://fb.example.com/index.php?fb=1
User-Call: http://fb.example.com/show.php?param=1&test=1
--> add a fb=1 param
Intern -> http://fb.example.com/show.php?fb=1¶m=1&test=1
URL 中应始终有一个名为“fb=1”的参数。
我怎样才能意识到这一点?
My problem: I want to have a rewriteRule that allows me to forward parameter to another directory on my server. I called a subdomain of my page and this subdomain should points on the "normal" directory of my root page. Addional to that the rule should add a parameter to all url's that will be called.
Example:
Root-Page: http://www.example.com -> directory on the server /srv/www/vhosts/example.com/httpdocs/
Subdomain: http://fb.example.come
Now the Root-Page and the Subdomain should point to the same directory:
Subdomain -> directory on the server /srv/www/vhosts/example.com/httpdocs/
The difference between both domains is a paramenter that should add to every URL call:
User-Call: http://fb.example.com/index.php
--> add a fb=1 param
Intern -> http://fb.example.com/index.php?fb=1
User-Call: http://fb.example.com/show.php?param=1&test=1
--> add a fb=1 param
Intern -> http://fb.example.com/show.php?fb=1¶m=1&test=1
There should always be a param called "fb=1" in the URL.
How can i realize this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
但我只是在你的 php 中添加一些代码来检测 fb.example.com 域。干净多了
But I would just put some code in your php to detect the fb.example.com domain. Much cleaner