Hey eveyone,
I have the following server block:
server {
listen 80;
server_name www.petpal.co.il;
return 301 http://petpal.co.il$request_uri;
}
server {
listen 80;
server_name petpal.co.il;
root /usr/share/nginx/petpal;
index index.php;
location / {
try_files $uri $uri/ @extensionless-php;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
error_page 404 /notfound;
location ~ \.php$ {
try_files $uri /notfound;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
What modifications do I have to make to it in order to:
* redirect users that try to access files with .php extension to the file without the extenstion, for example dogs.php to dogs (for SEO purposes, the execution proccess already exist).
* Make it so the 404 document will be displayed according to the directory the user is currently in, for example in directory "/en" it would display /en/notfound, in directory "/" it would display "/notfound"...
* Change pages with query strings syntax for example: article?id=1 to article-1
Thanks to the helpers
I have the following server block:
server {
listen 80;
server_name www.petpal.co.il;
return 301 http://petpal.co.il$request_uri;
}
server {
listen 80;
server_name petpal.co.il;
root /usr/share/nginx/petpal;
index index.php;
location / {
try_files $uri $uri/ @extensionless-php;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
error_page 404 /notfound;
location ~ \.php$ {
try_files $uri /notfound;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
What modifications do I have to make to it in order to:
* redirect users that try to access files with .php extension to the file without the extenstion, for example dogs.php to dogs (for SEO purposes, the execution proccess already exist).
* Make it so the 404 document will be displayed according to the directory the user is currently in, for example in directory "/en" it would display /en/notfound, in directory "/" it would display "/notfound"...
* Change pages with query strings syntax for example: article?id=1 to article-1
Thanks to the helpers