vincentg

Well-Known Member
May 12, 2004
172
4
168
new york
Really it's two problems
The site is auto redirecting to SSL and yet there is no setting to do so.
All other redirects except one to redirect www to domain works fine.

No matter how I try I can not redirect www
Set a redirect in cpanel - picked the main domain - set it to only redirect www
Nothing happens.
It's like the entry in htaccess doesn't exist.

Prior to the new setting Cpanel added in domain to set it to redirect to SSL I never had this problem.

Is there someplace other than apache conf where a redirect takes place?
If you know where it is please let me know.

I already have run into loop problems with this new cpanel update on redirects.

Example - do a redirect with or without www on your main domain and now you have a loop
why ?
Because there is redirect in place to go to SSL which is where ???
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,867
1,535
313
cPanel Access Level
Root Administrator
Hey there! Would this be a WordPress site? The siteurl value along with various plugins can determine how redirection happens, and that is outside both Apache and .htaccess. A tool such as the ReallySimpleSSL plugin is great to take care of those issues.

If this is another CMS-style site, I'd recommend the same thing - looking through the site code itself and other settings to see if that is where the issue happens.
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
No matter how I try I can not redirect www
Set a redirect in cpanel - picked the main domain - set it to only redirect www
Nothing happens.
It's like the entry in htaccess doesn't exist.
what is the outcome of what your trying to do ?

so you want your domain to be https://domain.com
and if they type www.domain.com you want it to redirect to https://domain.com

is this correct?
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
Hey there! Would this be a WordPress site? The siteurl value along with various plugins can determine how redirection happens, and that is outside both Apache and .htaccess. A tool such as the ReallySimpleSSL plugin is great to take care of those issues.

If this is another CMS-style site, I'd recommend the same thing - looking through the site code itself and other settings to see if that is where the issue happens.
@cPRex i tried to do both domain http://www.domain.com and domain.com via cPanel
to https//:domain.com
when i type http://domain http://www.domain redirects to https://domain
when i type in https://www.domain it stays at https://www.domain but should redirect to https://domain

is this a bug

I've also tested only redirect www to https://domain
and if it has https://www.domainit will not redirect


so if an user want's his domain to redirect to https://domain.com
in cPanel it does not work. cause if you type https://www.domain.com will not redirect to https://domain.com
 
Last edited:

vincentg

Well-Known Member
May 12, 2004
172
4
168
new york
Yes - I want https://domain and not https://www.domain

Really three things I want and all but www works
One is working by itself - http:// to https:// - I have no clue what is doing it as I believe this is causing the problem redirecting www
I can't get www to redirect
I can get the IP to redirect - this so google doesn't have links showing my IP


Not wordpress
Simple PHP script
No redirects in that script.
Works fine on my local PC

Checked every line in htaccess - nada
Checked httpd.conf nada

So where is the mystery redirect coming from?

This started shortly after a move from an older server.
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,867
1,535
313
cPanel Access Level
Root Administrator
@Spirogg - I'd need some more details, but it likely isn't a wildcard redirect match so it won't override the www if manually included. You'd need to use .htaccess rules to make that happen.

@vincentg - it doesn't sound like this is a cPanel issue, but a problem with the application itself. If you have root access to the machine we'd be happy to take a look at the system for you to ensure the webserver and redirection processes are working well if you're able to submit a ticket.
 

vincentg

Well-Known Member
May 12, 2004
172
4
168
new york
For years the site was working fine but recently it crashed.
This due to a redirect I had to redirect http:// to https://
This 2 lines in htaccess caused it to loop
Happened a short time ago.
Had the tech at Multacom look it over and he was at a loss.
Neither of us could figure this out

All that's in the php script that references https is one line.
<link rel="canonical" href="Business Website Hosting Services | Reseller Web Hosting - New York, USA"/>

Other than that there is nothing but html page code
I wrote it so I know what's in it.

To resolve the loop problem we removed the two lines to redirect http to https

there is only three redirects left other than
# 400 - Bad Request
ErrorDocument 400 /error.php

# 401 - Unauthorized
ErrorDocument 401 /error.php

# 402 - Payment Required
ErrorDocument 402 /error.php

# 403 - Forbidden
ErrorDocument 403 /error.php

# 404 - Not Found
ErrorDocument 404 /error.php

There has been a added feature in cpanel for Domain
A check box to redirect to SSL

I noticed it doesn't add an entry to htaccess when checked.
where does it save it's setting?

Maybe something there is causing my problem.

No need for you to access the server - just clue me in on where to check.

It's not a bad entry in httpd.conf as that's perfect.
It's not from htaccess
and it's not from index.php

The guys at Multacom are top notch and I'm not too bad either.
What ever is causing this problem is not simple.
 

vincentg

Well-Known Member
May 12, 2004
172
4
168
new york
Have a second site on server with same problem
Auto redirecting to SSL and can't redirect www
In checking I find some work and some don't.

From where I stand the problem is without a doubt due to this new setting in Domains

1652393354582.png

My gut tells me that it's on even though it shows off

Where does it save the setting?
 
Last edited:

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
Have a second site on server with same problem
Auto redirecting to SSL and can't redirect www
In checking I find some work and some don't.

From where I stand the problem is without a doubt due to this new setting in Domains

View attachment 77869

My gut tells me that it's on even though it shows off

Where does it save the setting?
theres more info about WP as well in this blog, but at least we find the area that it is stored in bold below.

here you go I found this for ya ;) hope this helps find the issue and please do let us know if this is ON even though its OFF in your settings

In the Domains interface in cPanel (Home >> Domains), there’s an option to enable Force HTTPS Redirection from the insecure version (HTTP) to the secure version (HTTPS) with a toggle switch. This information is stored in the account’s user data files (/var/cpanel/userdata), and the redirection is built into the domain’s vhost configuration.


All domains with valid SSL certificates can have redirection enabled. Aliases (historically called Parked Domains) will inherit their redirection status from their parent domain. No longer will a manual .htaccess redirect, plugin, or Apache configuration update be required. Now, an end-user can toggle a switch to redirect visitors to the secured version of your sites!


Kind Regards,
Spiro
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
[[email protected] ~]# cd /var/cpanel/userdata/cpanel-username
then cat cpanel-username

at the very bottom you will see it

I turned it ON
Code:
servername: domain.com
ssl: 1
ssl_redirect: 1
usecanonicalname: 'Off'
user: cpanel-username
userdirprotect: ''
I turned it OFF
Code:
servername:domain.com
ssl: 1
ssl_redirect: ''
usecanonicalname: 'Off'
user: cpanel-username
userdirprotect: ''
i am using Almalinux and cPanel 102.0.15
just fyi so it seems it turns it off here. but this is only the settings area. so need to find in maybe apache vhost file the actual rule ?
still looking
 
Last edited:

vincentg

Well-Known Member
May 12, 2004
172
4
168
new york
Spirogg - thank you for the examples as that would have been my next question

ssl_redirect: '' is missing

Have

servername: domain.com
ssl: 1
usecanonicalname: 'Off'
user: user_name
userdirprotect: ''

Every account is same so this I think explains it
Doesn't matter what the setting is - on or off, the setting entry ssl_redirect: is not there at all
Now how do we fix it?
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator

Found this reference in docs.
  • Include files with local overrides cause the system to permanently disable the Force HTTPS Redirects option in cPanel’s Domains interface (cPanel >> Home >> Domains >> Domains).
but still looking to find where the virtual for a cPanel-user is
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator

Found this reference in docs.
  • Include files with local overrides cause the system to permanently disable the Force HTTPS Redirects option in cPanel’s Domains interface (cPanel >> Home >> Domains >> Domains).
but still looking to find where the virtual for a cPanel-user is
Spirogg - thank you for the examples as that would have been my next question

ssl_redirect: '' is missing

Have

servername: domain.com
ssl: 1
usecanonicalname: 'Off'
user: user_name
userdirprotect: ''

Every account is same so this I think explains it
Doesn't matter what the setting is - on or off, the setting entry ssl_redirect: is not there at all
Now how do we fix it?
Ps do you have local overides in Apache virtual host
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
Do you have a test account I saw somewhere in a post that there is a rebuild user data maybe if you have a test account and do t see that file possibly it might rebuild and issue would be gone. ?
Let me find that link
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
@vincentg
Ok I found this link.
For resting user data file.
I believe this might help
But you can maybe make a copy of your file and try this and then if anything is wrong you can revert back to original.
Here is the link



here is the cpanel docs for user data just fyi

 
Last edited:

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
@vincentg

Ps. I wonder if you add the part that’s missing by nano into that file and just add
ssl_redirect: ''
Restart Apache and see if that works.
also go to domain and click force On then com back to userdata file and see if it changed to

ssl_redirect: '1'

Then go back and turn it OFF
And see if it changes back to

ssl_redirect: ''

Then you know it’s working ?
Better trying this first then doing the user data update script. ?
 

vincentg

Well-Known Member
May 12, 2004
172
4
168
new york
Ran upcp --force

Now we have this setting

But still it's same
Can't do a redirect away from www
and no matter the setting it auto switches to ssl

Is this a problem only on this server or do others have it too?

cPanel & WHM v102.0.15 (STANDARD)

Operating System AlmaLinux v8.6.0

Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz
 

Spirogg

Well-Known Member
Feb 21, 2018
668
142
43
chicago
cPanel Access Level
Root Administrator
Ran upcp --force

Now we have this setting

But still it's same
Can't do a redirect away from www
and no matter the setting it auto switches to ssl
I’m not following you on can’t do a redirect away from www
Are you meaning you want to redirect to domain.com vs www.domain.com