将特定子域名重定向到Apache2 Linux服务器中的不同URL

huangapple go评论72阅读模式
英文:

Redirect a specific subdomain to a different URL in apache2 linux server

问题

有人能帮我将特定子域名重定向到 apache2 Linux 服务器中的不同 URL 吗?

英文:

Can someone help me Redirecting a specific subdomain to a different URL in the apache2 Linux server

答案1

得分: 1

创建一个名为.htaccess的文件,并将以下内容复制到其中:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^test.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/page [L]

根据需要替换域名和地址。

文档链接:httpd.apache.org/docs/2.4/rewrite/remapping.html

英文:

make a file named .htaccess, and give it the following content:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^test.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/page [L]

replace domain and address as needed

docs: httpd.apache.org/docs/2.4/rewrite/remapping.html

huangapple
  • 本文由 发表于 2023年5月28日 15:45:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76350452.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定