htaccess的子域名与所有的变量文件参数(.htaccess sub domain as file parameter with all the variables)

   IT问题网   2018-12-07 00:00:00

问 题

我想用的.htaccess(linux的/阿帕奇),使这个url重定向。

我想保持"原样"对于这样的www子域中的所有通话

www.example.com/index.php
www.example.com/test.phpid=1amp;name=a
www.example.com/whatever.phpwhateverurl=xxxx
 

但我想重定向所有外卡的网址是这样的子域名作为额外的变量,以目前的无限任何url的变量

例如

xxx.example.com-  example.com/subdomain=xxx
yyy.example.com/index.php-  example.com/index.phpsubdomain=yyy
whatever.example.com/test.phpvar=1-  example.com/test.phpsubdomain=whateveramp;var=1
whatever.example.com/whatever.phpvar1=1amp;var2=2-  example.com/whatever.phpsubdomain=whateveramp;var1=1amp;var2=2
 

这可能吗?

感谢您

解决方案

在您设置的通配符dns记录你应该让你的的.htaccess 文件:

rewriteengine叙述上
的rewritecond%{http_host} ^ www.example \ .com $
重写规则^(。*)\  $ $ 1个主机=%{http_host}&amp(*);?%{query_string} [1] [l]
 

这个规则的作用,但它会为您提供了一大堆,而不仅仅是子域,你就必须在你的php解析。

标签:域名有的变量文件参数



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

字preSS定制的mod_rewrite - totalnoob?(Wordpress custom mod_rewrite - totalnoob)

problem i'm trying to make a custom mod_rewrite rule for ...

我怎样才能让我的网址,从这个例子中友好吗?(How can I make my urls friendly from this example)

problem my site currently displays like this (when clicki ...

htaccess的问题强制SSL(.htaccess issue to force SSL)

problem i activated ssl on one of my sites (based on word ...

IfModule不会出现是工作?(IfModule doesn't appear to be working)

problem if i use this: lt;ifmodule mod_rewrite.cgt; rewr ...

我怎样才能利用外界信息的URL重写?(How can I get use outside information in url rewrites)

problem hopefully some of you .htaccess gurus can help me ...

基于URL到一个新的页面的RewriteCond重写规则进行的.htaccess,定期EX pression(RewriteCond RewriteRule for .htaccess based on URL to a new page, regular expression)

problem i have an interesting rewriterule and i am not su ...

的.htaccess,mod_rewrite的,正则表达式用目录和文件类型(.htaccess, mod_rewrite, regex with directory and filetype)

problem i want to do a rewrite with the following conditi ...

.htaccess的语言重定向310错误(Htaccess language Redirect 310 error)

problem i have a two language site swedish sidewww.site ...

重定向一切的index.php(Redirection everything to index.php)

problem i wan't to redirect everything to index.php exepe ...

生成SE友好的URL的.htaccess国防部重写(Generating SE friendly URL .htaccess mod rewrite)

problem i've a url which get file name through get method ...

htaccess的子域名重定向(htaccess subdomain redirect)

problem i've searched around and tried a few ...

UrlRewrite 3 GET请求(UrlRewrite with 3 get request)

problem i'm working on a project and stuck on urlrewrite. ...

mod_rewrite的:恶意重定向(Mod_ReWrite: Unwanted redirect)

problem possible duplicate: .htaccess, clean ...

限制用户子目录(limiting users to subdirectories)

problem i have a subdirectory of users that i want to lim ...

重定向子文件夹的.htaccess(Redirection Subfolder Htaccess)

problem i want a redirect using htaccess i have a post na ...

使用的.htaccess,从来没有表现出的index.php(Using .htaccess, never show index.php)

problem how can i never show index.phpfor example, all re ...

在子域的内部服务器错误(internal server error in subdomains)

problem i installed worpress to my main domain abcd.com. ...

基于用户代理手机网站重定向(Mobile website redirection based on user agent)

problem say i've got two distinct domains: ...

的Joomla htaccess的不工作(Joomla htaccess not working)

problem i am using joomla 1.7 and using joomla's built in ...

扩大友好的URL,国防部重写(Expanding friendly url, mod rewrite)

problem i am using modx, which is a cms system. it has a ...