NGINX Remove index.php /index.php/something/more/ to /something/more
- by Gaston
I'm trying to clean urls in NGINX using framework DooPHP.
This =
- http://example.com/index.php/something/more/
To This =
- http://example.com/something/more/
I want to remove (clean url) the "index.php" from the url if someone try to enter in the first form. Like a permanent redirect.
How to do this config on NGINX?
Thanks.
[Update: Actual nginx config]
server {
listen 80;
server_name vip.example.com;
rewrite ^/(.*) https://vip.example.com/$1 permanent;
}
server {
listen 443;
server_name vip.example.com;
error_page 404 /vip.example.com/404.html;
error_page 403 /vip.example.com/403.html;
error_page 401 /vip.example.com/401.html;
location /vip.example.com {
root /sites/errors;
}
ssl on;
ssl_certificate /etc/nginx/config/server.csr;
ssl_certificate_key /etc/nginx/config/server.sky;
if (!-e $request_filename){
rewrite /.* /index.php;
}
location / {
auth_basic "example Team Access";
auth_basic_user_file config/htpasswd;
root /sites/vip.example.com;
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /sites/vip.example.com$fastcgi_script_name;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}