Welcome! Log In Create A New Profile

Advanced

Redirection 301 create "Redirection loop" while using wordpress site.

Muhammad Yousuf Khan
April 12, 2016 10:34AM
Dear All,

I am very new to nginx and trying to learn it from very basic. i have a
website and i am willing to remove the "www" before my actual domain name.
the solution so far i have find out on google is very simple.

so when ever any of the visitor visits my website by using www.xxx.com he
should be redirected to xxx.com. fortunately everything is working as
expected i can load php files and html file correctly, however when i try
to load my actual website my browser shows error "redirection loop created"

here is the config code of my website.

server {
server_name www.xxx.com;
return 301 $scheme://xxx.com$request_uri;
}

server {
server_name xxx.com;
root /var/www/html/xxx/public_html;
index index.php info.php;
access_log /var/log/nginx/xxx.com/access.log;
error_log /var/log/nginx/xxx.com/error.log;

location / {
try_files $uri $uri/ /index.php?q=$request_uri;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;


location ~ \.php$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}

location ~*
\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|woff|woff2)$
{
add_header Access-Control-Allow-Origin xxx.com;

}

}



I can access php files properly like info.php. to check whether php is
working or not. however the problem part is wordpress.

when i try to load my wordpress site chrome shows an error saying reduction
loop occur.

Any friendly advice will be highly appreciated.

Thanks,
Yousuf
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Redirection 301 create "Redirection loop" while using wordpress site.

Muhammad Yousuf Khan April 12, 2016 10:34AM

Re: Redirection 301 create "Redirection loop" while using wordpress site.

Alt April 12, 2016 11:02AM

Re: Redirection 301 create "Redirection loop" while using wordpress site.

Steve Wilson April 12, 2016 11:08AM

Re: Redirection 301 create "Redirection loop" while using wordpress site.

Muhammad Yousuf Khan April 13, 2016 02:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 159
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready