XF 2.2 Too Many Redirects

Erin Nicole

Member
I have already read this: https://xenforo.com/community/threads/too-many-redirects-after-change-installation-folder.201686/

Doesn't seem to be my problem as those lines aren't in my .htaccess and I've tried resetting the .htaccess from the beginning and that didn't help.
This is my .htaccess
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #    This line may be needed to workaround HTTP Basic auth issues when using PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

I'm not sure what is causing it. Site: https://codinghelp.site

This is what I get when running curl commands for my website...
Code:
root@codinghelp:~# curl -I http://codinghelp.site
HTTP/1.1 301 Moved Permanently
Server: nginx/1.20.2
Date: Wed, 23 Feb 2022 00:29:55 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
Location: https://codinghelp.site/

root@codinghelp:~# curl -I http://www.codinghelp.site
HTTP/1.1 301 Moved Permanently
Date: Wed, 23 Feb 2022 00:30:08 GMT
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Wed, 23 Feb 2022 01:30:08 GMT
Location: https://www.codinghelp.site/
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=G3LXi2987ibqhFJKPxqRSSkwwshZNtfed7xcoxTB1MK4mnU3Ij3xoKNOGMTS8yia6LGMh91VA9fo%2FiyarI9t41U%2FE2r%2BaXemrAApTaGnmxdUg%2BEaPIMfzRVfrqtIs%2Bp9FKGNgwq%2BXL5jInUK2qMZ82Gk"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 6e1c58049921cf68-IAD
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

root@codinghelp:~# curl -I https://codinghelp.site
HTTP/2 200
server: nginx/1.20.2
date: Wed, 23 Feb 2022 00:30:29 GMT
content-type: text/html; charset=utf-8
content-length: 107255
x-powered-by: PHP/8.0.15
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
last-modified: Wed, 23 Feb 2022 00:30:29 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
cache-control: private, no-cache, max-age=0
set-cookie: xf_csrf=kjpfDepnuKcACTL7; path=/; secure
strict-transport-security: max-age=31536000

root@codinghelp:~# curl -I https://www.codinghelp.site
HTTP/2 301
date: Wed, 23 Feb 2022 00:30:43 GMT
content-type: text/html
location: https://www.codinghelp.site/
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=xb0vZ7Cgyrmu6nddQnIOx7Pm6%2BBuBcIOMCOIbsbLqMKt7MOZvmcjqAwlwL%2FMbd8HKoq8UKscVEo3Rjn49VyTYDWXyKC2AkOxIOPxpWpx5szFRq6wDA8G79hA%2FPU3TmR8zlaGdd7Dcqo3Ie6Jca7HERT8"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 6e1c58e08c25826c-IAD
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

Since I got the 301 I did some googling and this is my nginx.conf file...
Code:
# this file was autogenerated, please do not edit
user www-data;
worker_processes  auto;
include /etc/nginx/modules-enabled/*.conf;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format fastpanel '[$time_local] $host $server_addr $remote_addr $status $body_bytes_sent $request_time $request $http_referer $http_user_agent';
    access_log  /var/log/nginx/access.log fastpanel;
    sendfile        on;
    keepalive_timeout  65;
    client_max_body_size 100m;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/fastpanel2-sites/*/*.conf;
    include /etc/nginx/sites-enabled/*.conf;
    server_names_hash_bucket_size 128;
}
I don't see anything I need to edit like what is shown here: https://airbrake.io/blog/http-errors/301-moved-permanently

Not sure how to fix this.... I recently moved from shared hosting to a VPS and uploaded the DB, updated the DB details in the config.php file and updated everything in cloudflare. I purged the cache in CF as well.

This error happens for other users as well as myself.

Edit: I was looking at the logs and maybe this is the error?
Code:
2022/02/23 00:56:01 [error] 18017#18017: *18703 FastCGI sent in stderr: "PHP message: string(12) "profile_post"
NULL" while reading response header from upstream, client: VPS IP, server: codinghelp.site, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/codinghelp.site.sock:", host: "codinghelp.site"
 
Last edited:
Solution
FIXED! I ended up moving hosts from hostinger to a friend's VPS. In the move they are now coming up. It was definitely some kind of .htaccess issue though. In case someone else has this issue. All of the too many redirects errors I've gotten thus far have been fixed by fixing the .htaccess files.

Erin Nicole

Member
Check Board URL does not have trailing /.

The primary URL to your board. Do not include a trailing "/" or "index.php". The URL should look similar to this: https://www.example.com/forum
It didn't on the previous install.

I can't get into admin CP or anything so I'm not sure what table to check for that in the database. I found the board URL row but it didn't have anything in the table and I didn't want to add anything for fear of messing this up more.
 

bzcomputers

Well-known member
I would create a simple html page and place it in the root directory. If you can access that page from a browser without the redirect issue then you can narrow it down to it being an issue with xenforo installation/setup itself and not the VPS setup overall.
 

Erin Nicole

Member
I would create a simple html page and place it in the root directory. If you can access that page from a browser without the redirect issue then you can narrow it down to it being an issue with xenforo installation/setup itself and not the VPS setup overall.
It isn't the VPS as other domains like my other forum running phpbb resolve fine: https://domainjunkie.site

Did that on CH and doesn't work: https://codinghelp.site/page.html

This is the page:
Code:
<!DOCTYPE html>
<html>
  <head>
    <title>
      HELLO
    </title>
  </head>
  <body>
    TEST
  </body>
</html>
 

Erin Nicole

Member
FIXED! I ended up moving hosts from hostinger to a friend's VPS. In the move they are now coming up. It was definitely some kind of .htaccess issue though. In case someone else has this issue. All of the too many redirects errors I've gotten thus far have been fixed by fixing the .htaccess files.
 
Solution
Top