.htaccess - 重定向目标 URL 在域后缺少斜杠
问题描述
我正在尝试将所有流量重定向到 HTTPS 和 WWW。
在我的 .htaccess 中使用它:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
但是转到我的域会example.com/blog
重定向到https://www.example.comblog
. 这在子目录之前的域之后没有斜杠。
有什么建议么?
解决方案
推荐阅读
- elasticsearch - Kubernetes - 将 pod 关联性规则应用于实时部署
- android - 如何将一个月划分为周android
- r - R Shiny - 动态显示/隐藏可编辑的数据表
- mysql - 实际上我有四种类型的访问,我需要计数,但进度为零
- java - 显示带有扩展 JFrame 的图像
- angular - TypeScript 在声明函数时显示错误
- python - 在Python中的字符串数组之前拆分字符串
- jquery - Jquery 3 按索引选择条件以显示或显示内容
- java - 避免在 Spring 数据 JPA 中获取 @ManyToOne 属性
- python - 无法从个人资料预览页面访问元素 - Webscraping Selenium Python