Community

Closed Too Many Redirects

KI
Kosta Ivanov #1

Hello, i have problem with new website :frowning: Too many redirects!

This is Error Log!

2022-05-18 19:24:01.704377 [INFO] [92386] Rewrite directive: bypassed.
2022-05-18 19:24:01.704394 [INFO] [92386] Invalid rewrite directive: DirectorySlash Off 2022-05-18 19:24:01.704467 [INFO] [92386] Rewrite directive: bypassed.
2022-05-18 19:24:01.704479 [INFO] [92386] Invalid rewrite directive: RewriteOptions AllowNoSlash
2022-05-18 19:24:01.704507 [INFO] [92386] Rewrite directive: bypassed.
2022-05-18 19:24:01.704519 [INFO] [92386] Rewrite directive: bypassed.

This is my .htaccess

Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.)$
RewriteRule ^(.
)$ http://%1/$1 [L,R=301]

End CyberPanel Generated Rules.

Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

End CyberPanel Generated Rules.

Begin permalinks – do not edit this section!

RewriteEngine On DirectorySlash Off
RewriteRule ^tools$ tools.php [NC,L,QSA]
RewriteRule ^tools/(.+)$ tool.php?id=$1 [NC,L,QSA]
RewriteRule ^account$ account/index.php [NC,L,QSA]
RewriteRule ^account/login$ account/login.php [NC,L,QSA]
RewriteRule ^account/register$ account/register.php [NC,L,QSA]
RewriteRule ^account/password\-reset$ account/password-reset.php [NC,L,QSA]
RewriteRule ^account/confirm$ account/confirm.php [NC,L,QSA]
RewriteRule ^account/websites$ account/websites.php [NC,L,QSA]
RewriteRule ^account/settings$ account/settings.php [NC,L,QSA]
RewriteRule ^account/signout$ account/signout.php [NC,L,QSA]
RewriteRule ^contact$ contact.php [NC,L,QSA]
RewriteRule ^embed$ embed.php [NC,L,QSA]
RewriteRule ^terms$ terms.php [NC,L,QSA]
RewriteRule ^privacy$ privacy.php [NC,L,QSA]
RewriteRule ^pricing$ pricing.php [NC,L,QSA]

# Fix for directory slashes
<IfModule mod_authz_core.c>
	RewriteOptions AllowNoSlash

	RewriteCond %{REQUEST_FILENAME} -d
	RewriteCond %{REQUEST_URI} ^(.+[^/])$
	RewriteRule ^ %1/ [R,L,QSA]
</IfModule>
### End permalinks
sh
shoaibkk #2

Reset to basic htaccess rewrite rules and restart lsws

NK
Nitesh Kunnath #3

Try this htaccess and reboot the server or restart openlitespeed.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
KI
Kosta Ivanov #4

@die2mrw007 , @shoaibkk it doesn’t get better, it gets worse :frowning:

On the local server without CyberPanel I fixed it by adding " AddType application/x-httpd-php .php " in /etc/apache2/mods-available/mime.conf

Regards!

NK
Nitesh Kunnath #5

You can send the login details in private message and I will have a check and guide where exactly is the issue. The issue is definitely a misconfiguration and you need to identify the same or else you can send me the login and I will check the same.

NK
Nitesh Kunnath #9

I have deleted your message containing the login details. As this is a public forum you are advised not to share such sensitive information here publicly.

Regarding your issue, make sure you have the code I shared above in the .htaccess file. There should be no other codes in the htaccess file apart from what I have suggested above and then restart the server and see if that resolves your issue.

NK
Nitesh Kunnath #10

I received the login credentials and upon checking I found that you are using a custom PHP script which has its own customized rewrite rules and on top of it you also added rewrite rules using the cyberpanel rewrite rules option which conflicted and had issues. I removed all the rewrite rules except the provided rules by the php script you using and it works perfect now.

I am marking this thread as solved.

This topic is closed to new replies.