Hello everybody, I got an issue here with cPanel redirects.
First, the issue is the main domain, but i try to understand all the problems and how actually the redirects work.
Part1:
Sub Domains:
I create in the interface redirect to the subdomain to the main domain:
# HTTP cPanel | Rewrite / Apache | Subdomains
now the interface rewrites this code inside htacsses this role to the subdomains,
this working perfectly, in HTTP and HTTPS Version is redirecting the subdomain perfect.
(i only suspicious of the way to redirects and what is recommended by cPanel, for example, HTTP redirect only and not HTTPS, i will note these questions in the end of the explanation)
_____________
Part 2:
Main Domain:
Ok here is a little tricky and unclear, this issue actually turns me a warning light in my head about problem number 1 i noted before Part 2.
When redirecting the main domain things start to be wired:
1. HTTP:X FORWARDED SSL, NOTED INSIDE HTACSSES AND NOT LIKE SUBDOMAINS. ( SUBDOMAINS RULES NEED TO BE REDIRECT BEFORE? HTTP:X FOR SSL RULE?)
2. NOT ABLE TO REDIRECT HTTP IN THE INTERFACE TO THE MAIN DOMAIN. (GET WARNING FROM CPANEL INTERFACE ABOUT LOOP REQUEST, ONLY HTTPS ALLOW)
3. MAIN DOMAIN REDIRECTS NOT WORK WITH STRING: "[OR]". (IT WORK IF I CREATE THE REDIRECTS SEPARATELY ONE BY ONE).
Code main domains redirects. (not working well because [OR] string):
Questions | Final conclusions:
1. %{HTTP:X-Forwarded-SSL} !on -> What is mean about the subdomains? (to redirect them HTTP or HTTPS?)
2. %{HTTP:X-Forwarded-SSL} !on -> Subdomains need to be redirected insitde htacsses before main domain?
3. [OR] string problem -> why mine domain does not work with this string?
3. [OR] string problem -> i note to warning in the interface about the wild card and the main domain:
what is mean? is mean I need to put them sepertly? what the actual order?
and how much time I need to put the code: %{HTTP: X-Forwarded-SSL} !on (like each redirect inside htacsses need the SSL code?)
What I did until now but - in the top of the htacssse - (www main domain not redirecting):
by the way, I force HTTPS throw the cPanel domain interface. (if it helps with this info).
The code above is Redirects from the cPanel interface, i didn't edit manually the code or something.
The only thing i did this: redirect first the subdomains to the main domain in the interface.
And then i create the redirect for the main domain (www and non-www redirects) as you see in the code.
if someone can tell me what is the right order, and the protocol for the subdomains (subdomains final URL in HTTPS? or HTTP? for subdomains?)
and explain why the subdomain does not have %{HTTP:X-Forwarded-SSL} !on, and if i actually need it for the subdomains, it is more then great
Be more than great if someone can order this code and noted it here in a message (with keeping the original code of cPanel Redirects more or less).
First, the issue is the main domain, but i try to understand all the problems and how actually the redirects work.
Part1:
Sub Domains:
I create in the interface redirect to the subdomain to the main domain:
# HTTP cPanel | Rewrite / Apache | Subdomains
Code:
RewriteCond %{HTTP_HOST} ^locksmithunit\.es\.locksmithunit\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.locksmithunit\.es\.locksmithunit\.com$
RewriteRule ^(.*)$ "https\:\/\/locksmithunit\.es\/$1" [R=301,L]
this working perfectly, in HTTP and HTTPS Version is redirecting the subdomain perfect.
(i only suspicious of the way to redirects and what is recommended by cPanel, for example, HTTP redirect only and not HTTPS, i will note these questions in the end of the explanation)
_____________
Part 2:
Main Domain:
Ok here is a little tricky and unclear, this issue actually turns me a warning light in my head about problem number 1 i noted before Part 2.
When redirecting the main domain things start to be wired:
1. HTTP:X FORWARDED SSL, NOTED INSIDE HTACSSES AND NOT LIKE SUBDOMAINS. ( SUBDOMAINS RULES NEED TO BE REDIRECT BEFORE? HTTP:X FOR SSL RULE?)
2. NOT ABLE TO REDIRECT HTTP IN THE INTERFACE TO THE MAIN DOMAIN. (GET WARNING FROM CPANEL INTERFACE ABOUT LOOP REQUEST, ONLY HTTPS ALLOW)
3. MAIN DOMAIN REDIRECTS NOT WORK WITH STRING: "[OR]". (IT WORK IF I CREATE THE REDIRECTS SEPARATELY ONE BY ONE).
Code main domains redirects. (not working well because [OR] string):
Code:
# HTTPS cPanel | Rewrite / Apache
#RewriteCond %{HTTPS} off
#RewriteCond %{HTTP:X-Forwarded-SSL} !on
#RewriteCond %{HTTP_HOST} ^locksmithunit\.es$ [OR]
#RewriteCond %{HTTP_HOST} ^www\.locksmithunit\.es$
#RewriteRule ^(.*)$ "https\:\/\/locksmithunit\.es\/$1" [R=301,L]
Questions | Final conclusions:
1. %{HTTP:X-Forwarded-SSL} !on -> What is mean about the subdomains? (to redirect them HTTP or HTTPS?)
2. %{HTTP:X-Forwarded-SSL} !on -> Subdomains need to be redirected insitde htacsses before main domain?
3. [OR] string problem -> why mine domain does not work with this string?
3. [OR] string problem -> i note to warning in the interface about the wild card and the main domain:
Code:
Note:
Checking the Wild Card Redirect Box will redirect all files within a directory to the same filename in the redirected directory.
You cannot use a Wild Card Redirect to redirect your main domain to a different directory on your site.
and how much time I need to put the code: %{HTTP: X-Forwarded-SSL} !on (like each redirect inside htacsses need the SSL code?)
What I did until now but - in the top of the htacssse - (www main domain not redirecting):
Code:
# HTTP cPanel | Rewrite / Apache | Subdomains
RewriteCond %{HTTP_HOST} ^locksmithunit\.es\.locksmithunit\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.locksmithunit\.es\.locksmithunit\.com$
RewriteRule ^(.*)$ "https\:\/\/locksmithunit\.es\/$1" [R=301,L]
# HTTPS cPanel | Rewrite / Apache
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteCond %{HTTP_HOST} ^locksmithunit\.es$ [OR]
RewriteCond %{HTTP_HOST} ^www\.locksmithunit\.es$
RewriteRule ^(.*)$ "https\:\/\/locksmithunit\.es\/$1" [R=301,L]
by the way, I force HTTPS throw the cPanel domain interface. (if it helps with this info).
The code above is Redirects from the cPanel interface, i didn't edit manually the code or something.
The only thing i did this: redirect first the subdomains to the main domain in the interface.
And then i create the redirect for the main domain (www and non-www redirects) as you see in the code.
if someone can tell me what is the right order, and the protocol for the subdomains (subdomains final URL in HTTPS? or HTTP? for subdomains?)
and explain why the subdomain does not have %{HTTP:X-Forwarded-SSL} !on, and if i actually need it for the subdomains, it is more then great
Be more than great if someone can order this code and noted it here in a message (with keeping the original code of cPanel Redirects more or less).