Changing a 302 redirect to 301

Currently reading
Changing a 302 redirect to 301

20
9
NAS
DS918+
Operating system
  1. Windows
Mobile operating system
  1. Android
Last edited:
Hi

My personal website has been flagged by Goole as "Deceptive Site Ahead" and after reading the forums I think it's because I have a 302 redirect rather than 301. I'm using the http to https method from this forum Tutorial - http to https redirect but have no idea how to change it

Any help would be greatly appreciated

1664954001691.png


1664954349235.png

-- post merged: --

This is the code I'm using

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Would this work?

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
This doesn't work for the redirect to the subdirectory
Code:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Code:
>>> http://rss.*****.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.*****.com/

>>> https://rss.******.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
 
Just in case anyone else has this issue, this isn't an issue with the .htaccess file. There's a redirect in the index.php file that doesn't have a redirect code explicitly mentioned, php defaults these to 302.

Replacing the line below with header("Location: /tt-rss/", true, 301); solves my issue

1665046138116.png
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

This page How do I migrate data between Synology NAS via Hyper Backup (DSM 6.0 and later)? - Synology...
Replies
2
Views
883
  • Question
thank you for your answer. i already binding my phone number to quickConnect service but it still return...
Replies
2
Views
640

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top