htaccess重定向所有子域(除了www)以使用参数进行索引(htaccess redirect all subdomains (except www) to index with parameters)
htaccess重定向所有子域(除了www)以使用参数进行索引(htaccess redirect all subdomains (except www) to index with parameters)
我想要做的是:
sub.domain.com
至
domain.com/index.php?q=sub
和
sub.domai
htaccess重定向所有子域(除了www)以使用参数进行索引(htaccess redirect all subdomains (except www) to index with parameters)
我想要做的是:
sub.至
/index.php?q=sub和
sub./somefile.php至
/sub/index.php?q=sub&file=somefile.php和
sub./somefile.php?m=12&r=12至
/sub/index.php?q=sub&file=somefile&m=12&r=12并使用子域保留地址栏。
我得到了一些代码,但它没有远程做我需要的东西,所以任何帮助都会非常感激。 谢谢!
What I'm trying to do is this:
sub.to
/index.php?q=suband
sub./somefile.phpto
/sub/index.php?q=sub&file=somefile.phpand
sub./somefile.php?m=12&r=12to
/sub/index.php?q=sub&file=somefile&m=12&r=12and keep the address bar with the subdomain.
I got some code but it's not remotely doing what I need, so any help would be really appreciated. Thanks!
最满意答案
RewriteEngine On #Rewrite foo./foo/bar to /index.php?q=foo&page=foobar #in the condition pattern bellow, we match against any http_host string that doesnt start with www RewriteCond %{HTTP_HOST} ^((?!www).+)\.domain\.com$ [C] #if the above condition is met, the rewrite the request RewriteRule ^(.*)$ /index.php?q=%1&file=$1 [QSA,C,L] RewriteEngine On #Rewrite foo./foo/bar to /index.php?q=foo&page=foobar #in the condition pattern bellow, we match against any http_host string that doesnt start with www RewriteCond %{HTTP_HOST} ^((?!www).+)\.domain\.com$ [C] #if the above condition is met, the rewrite the request RewriteRule ^(.*)$ /index.php?q=%1&file=$1 [QSA,C,L]#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
上传时间: 2023-04-13 21:41:53
推荐阅读
留言与评论(共有 11 条评论) |
本站网友 吉利新车 | 17分钟前 发表 |
the rewrite the request RewriteRule ^(.*)$ /index.php?q=%1&file=$1 [QSA | |
本站网友 2012黄色片 | 19分钟前 发表 |
L] | |
本站网友 梯田油菜花 | 27分钟前 发表 |
the rewrite the request RewriteRule ^(.*)$ /index.php?q=%1&file=$1 [QSA | |
本站网友 福州经济适用房 | 18分钟前 发表 |
sub. to /index.php?q=sub and sub./somefile.php to /sub/index.php?q=sub&file=somefile.php and sub./somefile.php?m=12&r=12 to /sub/index.php?q=sub&file=somefile&m=12&r=12 and keep the address bar with the subdomain. I got some code but it's not remotely doing what I need | |
本站网友 pe投资 | 12分钟前 发表 |
但它没有远程做我需要的东西 | |
本站网友 綦江二手房 | 29分钟前 发表 |
so any help would be really appreciated. Thanks! 最满意答案 RewriteEngine On #Rewrite foo./foo/bar to /index.php?q=foo&page=foobar #in the condition pattern bellow | |
本站网友 北京东大肛肠 | 7分钟前 发表 |
C | |
本站网友 共享上网软件 | 6分钟前 发表 |
we match against any http_host string that doesnt start with www RewriteCond %{HTTP_HOST} ^((?!www).+)\.domain\.com$ [C] #if the above condition is met | |
本站网友 杜蕾斯破产 | 2分钟前 发表 |
C | |
本站网友 利血平 | 28分钟前 发表 |
所以任何帮助都会非常感激 |