After installing ssl certificate my site is not working anymore. I am running my cakephp 1.3 site on vps it work just fine without https but when i enable https it through too many redirects error and when i looked into debug tool i see redirect loop from http (301) -> https (302) -> http -> https
I have added mode_rewrite rules in .htaccess files in all locations
root -> .htaccess, app./.htaccess, app/webroot.htaccess I also made few tweaks in the code but i found that it never reach to code when i enable https. right now i am not using.htacess instead i am directly pointing my vhost to webroot folder but still getting loop of redirects
I also checked my dns advanced setting found no issue there.
Redirects image link: https://gitlab.com/CPW2DO/newsite/uploads/a85856bcea45f463aa906916cf0025be/too_many_redirects_http.png
Dns settings Link:
https://gitlab.com/CPW2DO/newsite/uploads/280ba2d0cbc8b2584726a26a94e76a4b/dns_settings.jpg
Any help would be very much appreciated thanks in advance.
Here how my vhost config.
<VirtualHost *:80>
DocumentRoot "/var/www/html/opa/staging/current/app/webroot"
<Directory /var/www/html/opa/staging/current/app/webroot>
Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# Require all granted
AllowOverride None
Order deny,allow
Allow from all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</Directory>
ServerName opa-staging.capwell.nl
ServerAlias www.opa-staging.capwell.nl
Redirect permanent / https://opa-staging.capwell.nl/
ErrorLog ${APACHE_LOG_DIR}/opa-staging-error.log
CustomLog ${APACHE_LOG_DIR}/opa-staging-access.log combined
</VirtualHost>
<virtualhost *:443>
DocumentRoot "/var/www/html/opa/staging/current/app/webroot"
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/certificate.key
SSLCertificateChainFile /etc/apache2/ssl/cabundle.crt
</virtualhost>
After following @Greg Schmidt comment i added my http config to https block and it worked (Yay)
<VirtualHost *:80>
DocumentRoot "/var/www/html/opa/staging/current/app/webroot"
<Directory /var/www/html/opa/staging/current/app/webroot>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Allow from all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</Directory>
ServerName opa-staging.capwell.nl
ServerAlias www.opa-staging.capwell.nl
Redirect permanent / https://opa-staging.capwell.nl/
ErrorLog ${APACHE_LOG_DIR}/opa-staging-error.log
CustomLog ${APACHE_LOG_DIR}/opa-staging-access.log combined
</VirtualHost>
<virtualhost *:443>
DocumentRoot "/var/www/html/opa/staging/current/app/webroot"
<Directory /var/www/html/opa/staging/current/app/webroot>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Allow from all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</Directory>
ServerName opa-staging.capwell.nl
ServerAlias www.opa-staging.capwell.n
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/certificate.key
SSLCertificateChainFile /etc/apache2/ssl/cabundle.crt
</virtualhost>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.