Welcome! Log In Create A New Profile

Advanced

Re: Trailing Slash redirection poblem

B.R.
May 01, 2016 10:46AM
So these opposite redirection rules are fighting each other and are the
source of your problem, which Francis helped you to alleviate.

Sit back, grab an erasable whiteboard, scratch your head and think about
your website's design: both rules probably have their use in their own
corner, but you shall not have them activated at the same spot at any given
time, as it will result in an infinite loop: a computer does exactly what
you tell it to do. There is nothing stupider than that.
The problem lies between the desk and the chair. ;o)

​Do not merely copy-paste pre-cooked Wordpress-hypothetically-ready
configuration directives​. Try to recreate it by hand, understanding the
use and intention of every line.
nginx docs http://nginx.org/en/docs/ will most probably come helpful.

Enjoy learning! :o)
---
*B. R.*

On Sun, May 1, 2016 at 10:18 AM, Muhammad Yousuf Khan <sirtcp@gmail.com>
wrote:

> just want to make it more clear that when i comment out this line #try_files
> $uri $uri.html $uri/ /index.php?q=$request_uri; error become 404 from
> redirection loop error.
>
> On Sun, May 1, 2016 at 1:16 PM, Muhammad Yousuf Khan <sirtcp@gmail.com>
> wrote:
>
>>
>> >>The configuration you have shown says "if the request is for /live/,
>> >>ask the browser to instead request /live".
>>
>> >>The configuration you have not shown says "if the request is for /live,
>> >>ask the browser to instead request /live/".
>>
>> Thanks for the tip I think I got the problem but could not resolve it.
>> try_files $uri $uri.html $uri/ /index.php?q=$request_uri;
>> I even tried deleting “$uri.html $uri/” but still creating loop. I know
>> this is a important line to display wordpress pages . now the error turn
>> 404 from redirection loop.
>>
>> >>You should not have both of those in the same configuration file, or
>> >>you get a loop.
>>
>> Yes I got this now as shared. Thanks for the tip again.
>>
>> >>The not-shown configuration is usually a very good idea if "/live"
>> >>is to be served from the filesystem and corresponds to a directory.
>>
>> >>So: why do you want to remove the trailing slash, in the shown
>> >>configuration?
>> Actually this is a requirement from my client.
>>
>> >>If you want /live to redirect to /live/, then you should configure thing
>> >>such that /live/ does not redirect to /live.
>>
>> No I want /live/ to be redirected to /live and the rule which is
>> redirecting /live to /live/ and ending up as loop Is also important. Any
>> helpful advice is highly appreciated.
>>
>>
>> On Sat, Apr 30, 2016 at 1:40 PM, Francis Daly <francis@daoine.org> wrote:
>>
>>> On Sat, Apr 30, 2016 at 12:47:20PM +0500, Muhammad Yousuf Khan wrote:
>>>
>>> Hi there,
>>>
>>> > I have been trying to remove the trailing slash with this redirection
>>> rule.
>>> > rewrite ^/(.*)/$ /$1 permanent;
>>> >
>>> > however it is creating a loop.
>>> >
>>> > curl -I https://xxxx.com/live/
>>> >
>>> > HTTP/1.1 301 Moved Permanently
>>> > Location: https://xxxx.com/live
>>>
>>> > curl -I https://xxxx.com/live
>>> >
>>> > HTTP/1.1 301 Moved Permanently
>>> > Location: https://xxxx.com/live/
>>>
>>> > Can you please guide what i am doing wrong here.
>>>
>>> The configuration you have shown says "if the request is for /live/,
>>> ask the browser to instead request /live".
>>>
>>> The configuration you have not shown says "if the request is for /live,
>>> ask the browser to instead request /live/".
>>>
>>> You should not have both of those in the same configuration file, or
>>> you get a loop.
>>>
>>> The not-shown configuration is usually a very good idea if "/live"
>>> is to be served from the filesystem and corresponds to a directory.
>>>
>>> So: why do you want to remove the trailing slash, in the shown
>>> configuration?
>>>
>>> If you want /live to redirect to /live/, then you should configure thing
>>> such that /live/ does not redirect to /live.
>>>
>>> f
>>> --
>>> Francis Daly francis@daoine.org
>>>
>>> _______________________________________________
>>> nginx mailing list
>>> nginx@nginx.org
>>> http://mailman.nginx.org/mailman/listinfo/nginx
>>>
>>
>>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Trailing Slash redirection poblem

Muhammad Yousuf Khan April 30, 2016 03:48AM

Re: Trailing Slash redirection poblem

Francis Daly April 30, 2016 04:42AM

Re: Trailing Slash redirection poblem

Muhammad Yousuf Khan May 01, 2016 04:18AM

Re: Trailing Slash redirection poblem

Muhammad Yousuf Khan May 01, 2016 04:20AM

Re: Trailing Slash redirection poblem

B.R. May 01, 2016 10:46AM

Re: Trailing Slash redirection poblem

Francis Daly May 02, 2016 05:20AM

Re: Trailing Slash redirection poblem

Muhammad Yousuf Khan May 02, 2016 08:50AM

Re: Trailing Slash redirection poblem

Francis Daly May 03, 2016 03:24PM

Re: Trailing Slash redirection poblem

Muhammad Yousuf Khan May 04, 2016 08:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 130
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready