Level 13
Use as like below
location / {
return 301 url:https://$host$request_uri;
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a recent site setup with Forge using LetsEncrypt for SSL. I'm aware there's a before/ssl_redirect.conf file that 301 redirects urls to https.
What I'm trying todo is allow specific urls through so they're not redirected but just handled by Laravel so that I can show them an app 404 instead of a server 404. Any ideas? Location blocks below:
# tried this
#location /tags/view {
# also this
#location = /tags/view/general {
# this seems to work and catch all tag urls e.g. /tags/view/general, /tags/view/laravel etc
location ^~ /tags/view {
# this has no effect and /tags/view/general 301 redirects to https
try_files $uri $uri/ /index.php?$query_string;
# this works if uncommented
#return 404;
}
location / {
return 301 https://$host$request_uri;
}
Please or to participate in this conversation.