I have a Magento Installation version 1.9.3.1. Until yesterday It was working fine, but now the frontpage is not working with the error - Too many redirects.
On further checking in the console(firebug), I can see all the files are showing as moved permanently as also it is adding a extra slash / that is two slash in the end of the sitename in the browser address. also in console all the get pages are showing as //
update:
I observed that it is only home-page/index.php where I am facing this issue. for example If I am accessing site/category-name it is working fine.
I tried to fix that using :
if(!$_SERVER['HTTPS'] || strtolower($_SERVER['HTTPS']) != 'on' ){
header("HTTP/1.1 301 Moved Permanently");
header('Location: https://' . str_replace('www.','',$_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI']);
exit();
}
but that also didn't worked.
Further Update:
if I use domain.com/index or domain.com/index.php/index I am able to access the site without
too many redirects error
or
moved permanently error
Contents of relevant conf file:
server {
listen 80;
server_name www.sub.domain.com;
#server_name sub.domain.com;
#rewrite ^(.*) http://sub.domain.com$1 permanent;
}
server {
listen 80 default;
listen 443 ssl;
server_name www.sub.domain.com;
#ssl on;
#ssl_certificate /key/domain.com.pem;
#ssl_certificate_key /key/domain.com.key;
# access_log off;
access_log /home/sub.domain.com/logs/access.log;
# error_log off;
error_log /home/sub.domain.com/logs/error.log;
root /home/sub.domain.com/public_html;
index index.php index.html index.htm;
server_name sub.domain.com;
location / {
try_files $uri $uri/ /index.php?$args;
}