www 重定向双斜线 [英] www redirect with double slash

查看:78
本文介绍了www 重定向双斜线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我进入我的网站 http://domain.com 时,它重定向到 http://www.domain.com//(末尾双斜线).

When I enter my website http://domain.com it redirects to http://www.domain.com// (double slash in the end).

奇怪的是,我没有在 .htaccess 文件中设置任何重定向.实际上那个文件是空的.我尝试在那里添加一些重写规则,但同样的问题再次出现.

What is strange, I haven't set any redirects in .htaccess file. Actually that file is empty. I've tried to add some rewrite rules there, but the same problem appeared again.

我不明白在哪里设置了非 www 到 www 的重定向?你有什么想法.

I can't understand where have been set that non-www to www redirect? Do you have any ideas.

谢谢.

推荐答案

尝试使用此代码从 url 中删除双斜杠.

Try using this code to remove double slashes from the urls.

RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} //
RewriteRule ^ $0 [R=302]

一旦开始工作,将 302 更改为 301.

Change the 302 to 301 once you get it working.

这篇关于www 重定向双斜线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆