This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Redirect to https
#1
Redirect to https
Hi

I have setup SSL up and works when i type https://www.domain.com.
When i type domain.com or www.domain.com i get error site cant be reach.
I read you can do this in your .htaccess file, but its not working.

My .htaccess file looks like this

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Reply
Thanks given by:
#2
RE: Redirect to https
That is because there is no vhost for the domain on port 80 so the web has no idea how to direct it.
I am not sure what tutorial you used to add SSL, but you possibly missed one little step:
  1. Module Admin>Apache Admin>Override A Virtual Host Setting>[select domain]>
  2. Port Override = 443
  3. Forward Port 80 to Overriden Port = check
  4. Save and wait ~5 mins for the new vhost to be generated and reloaded
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#3
RE: Redirect to https
Hi

I used the following
http://forums.sentora.org/showthread.php?tid=2535

I have done the steps.

here is the /etc/sentora/configs/apache/httpd-vhost.conf


Code:
# DOMAIN: xxx.co.za
<virtualhost *:443>
ServerName xxx.co.za
ServerAlias  www.xxx.co.za
ServerAdmin jidewet@xxx.co.za
DocumentRoot "/var/sentora/hostdata/xxx/public_html/xxx_co_za"
php_admin_value open_basedir "/var/sentora/hostdata/xxx/public_html/xxx_co_za:/var/sentora/temp/"
php_admin_value suhosin.executor.func.blacklist "passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec"
ErrorLog "/var/sentora/logs/domains/xxx/xxx.co.za-error.log"
CustomLog "/var/sentora/logs/domains/xxx/xxx.co.za-access.log" combined
CustomLog "/var/sentora/logs/domains/xxx/xxx.co.za-bandwidth.log" common
<Directory "/var/sentora/hostdata/xxx/public_html/xxx_co_za">
 Options +FollowSymLinks -Indexes
 AllowOverride All
 Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 510 /_errorpages/510.html
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 500 /_errorpages/500.html
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
# Custom Global Settings (if any exist)

# Custom VH settings (if any exist)
# Alias for roundcube WebMail login
Alias "/webmail" "/etc/sentora/panel/etc/apps/webmail"
<Directory "/etc/sentora/panel/etc/apps/webmail/">
 Options +FollowSymLinks -Indexes
  AllowOverride All
  Require all granted
</Directory>
SSLEngine on
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
SSLCertificateFile /etc/letsencrypt/live/xxx.co.za/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/xxx.co.za/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/xxx.co.za/chain.pem
# Keeping bellow for future upgrades.
# Requires Apache >= 2.4
SSLCompression off
</virtualhost>
# END DOMAIN: xxx.co.za
################################################################



# DOMAIN: xxx.co.za
# PORT FORWARD FROM 80 TO: 443
<virtualhost *:80>
ServerName xxx.co.za
ServerAlias www.xxx.co.za
ServerAdmin jidewet@xxx.co.za
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</virtualhost>
# END DOMAIN: xxx.co.za
Reply
Thanks given by:
#4
RE: Redirect to https
Start your custom vhost with </virtualhost>.
Edit: And don't end with </VirtualHost> on your custom vhost entre, this is a bit weird with Sentora but it works like this.

My Sentora DemoMy GithubAuxio Github
Zentora themeS-Type themeCstyleX theme
flat-color-iconssmall-n-flat-icons

Sentora's development takes way too long, so i'm transitioning to HestiaCP.
Reply
Thanks given by:
#5
RE: Redirect to https
Thanks

But Apache fails to start then

Syntax error
Reply
Thanks given by:
#6
RE: Redirect to https
Maybe my eyes are missing it, here's mine:

Code:
# DOMAIN: domain.com
<virtualhost *:443>
ServerName domain.com
ServerAlias  www.domain.com
ServerAdmin tgates@domain.com
DocumentRoot "/var/sentora/hostdata/zadmin/public_html/domain_com"
ErrorLog "/var/sentora/logs/domains/zadmin/domain.com-error.log"
CustomLog "/var/sentora/logs/domains/zadmin/domain.com-access.log" combined
CustomLog "/var/sentora/logs/domains/zadmin/domain.com-bandwidth.log" common
<Directory "/var/sentora/hostdata/zadmin/public_html/domain_com">
 Options +FollowSymLinks -Indexes
 AllowOverride All
 Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 415 /_errorpages/415.html
ErrorDocument 413 /_errorpages/413.html
ErrorDocument 400 /_errorpages/400.html
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 500 /_errorpages/500.html
ErrorDocument 408 /_errorpages/408.html
ErrorDocument 510 /_errorpages/510.html
DirectoryIndex index.php index.html index.htm index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
# Custom Global Settings (if any exist)

# Custom VH settings (if any exist)
SSLEngine on
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
SSLCertificateFile /etc/letsencrypt/live/domain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/domain.com/chain.pem
# Keeping below for future upgrades.
# Requires Apache >= 2.4
SSLCompression off

# Alias for MySQL login
Alias "/mysql" "/etc/sentora/panel/etc/apps/phpmyadmin"
<Directory "/etc/sentora/panel/etc/apps/phpmyadmin/">
   php_admin_value open_basedir /etc/sentora/panel/etc/apps/phpmyadmin
   Options +FollowSymLinks -Indexes
   AllowOverride All
   Require all granted
</Directory>
# Alias for roundcube WebMail login
Alias "/webmail" "/etc/sentora/panel/etc/apps/webmail"
<Directory "/etc/sentora/panel/etc/apps/webmail/">
   php_admin_value open_basedir /etc/sentora/panel/etc/apps/webmail
   Options +FollowSymLinks -Indexes
   AllowOverride All
   Require all granted
</Directory>
# Alias for rainloop WebMail login
Alias "/mail" "/etc/sentora/panel/etc/apps/rainloop"
<Directory "/etc/sentora/panel/etc/apps/rainloop/">
   php_admin_value open_basedir /etc/sentora/panel/etc/apps/rainloop
   Options +FollowSymLinks -Indexes
   AllowOverride All
   Require all granted
</Directory>

</virtualhost>
# END DOMAIN: domain.com
################################################################



# DOMAIN: domain.com
# PORT FORWARD FROM 80 TO: 443
<virtualhost *:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin tgates@domain.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</virtualhost>
# END DOMAIN: domain.com
PS: Always put code in either [code] or [php] tags for better forum viewing.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#7
RE: Redirect to https
they look the same
Reply
Thanks given by:
#8
RE: Redirect to https
Ok, just to review... remove the http/https redirect from the .htaccess
Use the port forward in the domain's custom vhost entry section (Module Admin>Apache Config>Override a Virtual Host>[select domain]

Port Override = 443
Forward Port 80 to Overriden Port = check
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#9
RE: Redirect to https
Have removed redirect from .htaccess

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
edited vhost
Port Override = 443
Forward Port 80 to Overriden Port = check

These are also checked.
Domain Enabled: = check
Suhosin Enabled: = check
OpenBase Enabled: = check
Reply
Thanks given by:
#10
RE: Redirect to https
Correct.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
[HOW TO] How to secure your sentora panel with SSL (HTTPS) easy guide SupaYoshi 32 134 ,110 11-18-2016, 05:34 AM
Last Post: worksmarter
Roundcube Webmail https path pthalmann 0 4 ,903 12-29-2014, 09:09 AM
Last Post: pthalmann

Forum Jump:


Users browsing this thread: 1 Guest(s)