Rewrite rules not working

Francis Daly francis at daoine.org
Fri Nov 11 08:51:55 UTC 2022


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 at daoine.org



More information about the nginx mailing list