0

NGINX index.html homepage redirect is needed, which will:

redirect:

https://homepage.co.uk/index.html

to:

https://homepage.co.uk

(without causing an infinite loop)

location = /index.html { return 301 homepage.co.uk/$1; }

UPDATED (Working Solution):

location /index.html {
    if ($request_uri = /index.html) {
        rewrite ^ http://$host? permanent;
    }
}
BennKingy
  • 1,265
  • 1
  • 18
  • 43
  • @ceejayoz Please help? :) – BennKingy Apr 24 '19 at 14:48
  • 1
    Try removing the `$1`. It makes little sense having it there. See also https://stackoverflow.com/questions/5675743/nginx-rewrite-rule-to-remove-index-html-from-the-request-uri. – ceejayoz Apr 24 '19 at 14:50
  • location /index.html { if ($request_uri = /index.html) { rewrite ^ http://$host? permanent; } } Thanks for that link, the code above works perfectly :) – BennKingy Apr 24 '19 at 15:00

0 Answers0