Welcome! Log In Create A New Profile

Advanced

Re: Rewrite rules not working

Francis Daly
November 11, 2022 03:54AM
On Thu, Nov 10, 2022 at 01:07:23PM -0500, blason wrote:

Hi there,

> I have a website http://web1.example.local/web1
> Instead I need a rewrite so that if user enters http://web1.example.local it
> will be diverted to http://web1.example.local/web1

If you want it to happen, without needing it to be a rewrite, you can
do a redirect with

location = / { return 301 /web1; }

(although I suspect that you will want a trailing slash there,
"/web1/;". And variants with a different http response code can be
used. And you can use the full "http://web1.example.local/web1/" if
you prefer.)

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

Rewrite rules not working

blason November 10, 2022 01:07PM

Re: Rewrite rules not working

Francis Daly November 11, 2022 03:54AM

Re: Rewrite rules not working

blason November 11, 2022 08:29AM

Re: Rewrite rules not working

Francis Daly November 11, 2022 03:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 200
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