Reputation: 1772
Introduction:
Situation:
Problem:
Question:
Idea:
Before changing to Nginx I was using Rewrites, it might be the solution:
RewriteCond %{SERVER_PORT} 80
RewriteCond %{THE_REQUEST} !/tpv [NC]
Ngnix conf for reference:
server {
listen 80;
listen [::]:80;
server_name .example.com;
root /home/forge/example.com/public;
location /tpv {
return 301 http://example.com/index.php/tpv;
}
location /index.php/tpv {
return 301 http://example.com/index.php/tpv;
}
location / { # the default location redirects to https
return 301 https://$host$request_uri;
}
}
Upvotes: 2
Views: 136
Reputation: 191
Prior to the good ideas you've got, try this simple magic code in conf ;)
server {
listen 80;
listen [::]:80;
server_name .example.com;
root /home/forge/example.com/public;
location ^~ /tpv* {
return 301 https://$host$request_uri;
}
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Upvotes: 1