regex - How can I solve the problem with fake/unwanted domain redirection?
问题描述
The problem is for some reason the website is accessible via fake/unwanted subdomains like:
whatever.example.com,
http://www.www.example.com,
ww2.example.com
blablala.example.com
The goal is to redirect from fake/unwanted subdomains to http://www.example.com using .htaccess Every contribution would be fully appreciated.
解决方案
把它放在 .htaccess 文件中:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
RewriteRule (.*) http://www.example.com/$1 [L,R=301,QSA]
推荐阅读
- r - 使用 R 中的 lapply 将值列表作为列添加到现有数据框
- node.js - firebase.storage 不是使用 node.js 的函数错误
- mysql - 数据库设计、邀请和活动
- ios - 终止应用程序两次以上后如何让定位服务提示
- javascript - 如何通过值 [JS] 获取对象的属性名称
- javascript - MUI瀑布工具栏实现
- python - 匹配所有出现的点并在字符串中的单词后用连字符替换
- dart - 缺少 dart:core lib Flutter
- javascript - React Google Maps 不显示 HeatMap ,lat 和 long 不适用于我的职位
- git - 拉取请求是否接受来自源分支的未来提交