.htaccess - 301 从非 www 到 www 的所有 URL
问题描述
我需要将路径中所有不带 www 的 URL 与 index.php 重定向到 www 版本中的相同。
我写了这个:
RewriteCond %{HTTP_HOST} ^
RewriteCond %{REQUEST_URI} ^/index.php/it/(.*)$ [NC]
RewriteRule ^(.*)$ https://www.DOMAIN.it/$1/? [L,R=301]
但结果是: https ://www.DOMAIN.it/index.php/it/SOMETHING/
我需要: https ://www.DOMAIN.it/SOMETHING/
怎么了?谢谢大家
解决方案
解决了,我删除了请求网址:
RewriteCond %{HTTP_HOST} !^(.*)\.domain\.it$ [NC]
RewriteRule ^index.php/it/(.*)$ https://www.domain.it/$1/ [R=301,L]
谢谢
推荐阅读
- android - Android ImageView 设置选择器以编程方式不起作用
- javascript - 从 javascript 调用包中定义的 AlpineJS 函数
- javascript - 如何在 iOS 的标题上方放置 Pulll 刷新指示器?
- python - 如何在kivy中打印循环中的文本输入
- javascript - 带有十进制值的 Wordpress woocommerce 产品数量
- javascript - 客户端验证在 Asp.Net Core 中不起作用
- javascript - 当我不认为它是异步的代码时,它的行为就像它是异步的
- react-native - React Native - 键盘自动隐藏
- haproxy - 即使在浏览会话结束后,基于 Haproxy Cookie 的路由也始终重定向到同一个节点
- excel - 用于将零件从装配体(钣金)导出为 DXF 格式的宏