将文件夹重写到子域 [英] Rewrite folder to subdomain

查看:77
本文介绍了将文件夹重写到子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此后我要重写所有地址

http://www.mydomain.com/questions/*

到此

http://*.mydomain.com/

例如:

http://www.mydomain.com/questions/example

http://example.mydomain.com/

有人可以帮我解决这个问题吗??

谢谢

I want to rewrite all addresses after this
http://www.mydomain.com/questions/*
to this
http://*.mydomain.com/
for example:
http://www.mydomain.com/questions/example
http://example.mydomain.com/
Can anyone help me in this issue!?
Thanks

推荐答案

去了。

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^.mydomain\.com$
RewriteRule ^questions/([^/]+)/?$ http://$1.mydomain.com/ [NC,R=301,L]

将其插入进入您的.htaccess文件,您应该一切顺利。 :)

Plug this into your .htaccess file and you should be good to go. :)

这篇关于将文件夹重写到子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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