地图多域仅使用htaccess

发布于 2025-01-01 22:49:43 字数 394 浏览 4 评论 0原文

我是越南人,所以我的英语不好。 我的 cms 有问题。 我想通过 htaccess 将子域映射到链接 例子: 链接

?user=example&op=value => example.domain.com/value/ and
domain.com/?user=example1&op=value1 => example1.domain.com/value1/ or
domain.com/?user=example2&op=value2 => example2.domain.com/value2/
..... ....

我有很多

。我正在使用共享托管,因此我无法编辑文件 http.config 或任何文件,我很抱歉,因为我的英语。 谢谢大家

I'm Vietnamese so my english is not good.
I have problem for my cms.
I want to map sub domain to as link via htaccess
Example:
I have links as

?user=example&op=value => example.domain.com/value/ and
domain.com/?user=example1&op=value1 => example1.domain.com/value1/ or
domain.com/?user=example2&op=value2 => example2.domain.com/value2/
..... ....

and many.

I'm using shares hosting so i can't edit file http.config or any one I'm sorry because my English.
Thank all

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爺獨霸怡葒院 2025-01-08 22:49:43

尝试将以下内容添加到 domain.com 网站根目录中的 .htaccess 文件中。

RewriteEngine on
RewriteBase / 

#if its domain.com
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] 
#capture the user and op query string values
RewriteCond %{QUERY_STRING} (^|&)user=([^&]+)&op=([^&]+)(&|$) [NC] 
#and redirect to subdomain with appropriate value
RewriteRule ^ http://%2.%{HTTP_HOST}/%3/? [L,R=301] 

Try adding the following to the .htaccess file in the root directory of your domain.com site.

RewriteEngine on
RewriteBase / 

#if its domain.com
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] 
#capture the user and op query string values
RewriteCond %{QUERY_STRING} (^|&)user=([^&]+)&op=([^&]+)(&|$) [NC] 
#and redirect to subdomain with appropriate value
RewriteRule ^ http://%2.%{HTTP_HOST}/%3/? [L,R=301] 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文