首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >跟着301号使用.htaccess重定向

跟着301号使用.htaccess重定向
EN

Stack Overflow用户
提问于 2022-10-05 12:21:28
回答 1查看 61关注 0票数 0

想知道是否有人能帮我。我试图删除302重定向从我的一个网站,但我不能得到正确的代码。它适用于第一个http -> https,但重定向到/tt-rss/的操作仍在使用302进行。

这就是我的using......can,有人帮我吗?

代码语言:javascript
复制
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
代码语言:javascript
复制
>>> http://rss.oliroe.com
> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------
Status: 301 Moved Permanently
Code:   301
Server: nginx
Date:   Wed, 05 Oct 2022 12:14:02 GMT
Content-Type:   text/html; charset=iso-8859-1
Content-Length: 231
Connection: close
Location:   https://rss.oliroe.com/

>>> https://rss.oliroe.com/
> --------------------------------------------
> 302 Found
> --------------------------------------------
Status: 302 Found
Code:   302
Server: nginx
Date:   Wed, 05 Oct 2022 12:14:03 GMT
Content-Type:   text/html; charset=UTF-8
Connection: close
X-Powered-By:   PHP/8.1.11
Location:   /tt-rss/
Strict-Transport-Security:  max-age=15768000; includeSubdomains; preload

>>> /tt-rss/
> --------------------------------------------
> 200 OK
> --------------------------------------------
Status: 200 OK
Code:   200
Server: nginx
Date:   Wed, 05 Oct 2022 12:14:03 GMT
Content-Type:   text/html; charset=UTF-8
Connection: close
X-Powered-By:   PHP/8.1.11
Cache-Control:  public
Strict-Transport-Security:  max-age=15768000; includeSubdomains; preload
EN

回答 1

Stack Overflow用户

发布于 2022-10-05 20:59:20

我已经解决了这个问题,网站在index.php头(“Location:/tt/”)中有这段代码;我没有意识到在php中重定向默认为302。将行更改为标头(“Location:/true/”,true,301);解决了我的问题。非常感谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73960276

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档