Answer the question
In order to leave comments, you need to log in
Rewrite for nginx, how to do it right?
Here is the htaccess attached to the script:
Options All -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?altum=$1 [QSA,L]
server {
listen 80;
server_name mysite;
set $base_root /var/www/mysite;
root $base_root;
charset utf-8;
index index.php;
autoindex off;
location / {
if (!-e $request_filename){
rewrite ^(.+)$ /index.php?altum=$1 break;
}
}
location ~ ^/.+\.php(/|$) {
fastcgi_pass php:9000; # proxy requests to a TCP socket
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_send_timeout 30000;
fastcgi_read_timeout 30000;
try_files $fastcgi_script_name =404;
}
}
Answer the question
In order to leave comments, you need to log in
server {
location / {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/(.*) /index.php?altum=$1;
}
location ~ \.php$ {
...
}
server {
location ~ \.php$ {
...
}
location ~ ^/(.*) {
try_files $uri $uri/ /index.php?altum=$1&$args;
}
map $uri $_uri {
~^/(.*) $1;
}
server {
location / {
try_files $uri $uri/ /index.php?altum=$_uri&$args;
}
location ~ \.php$ {
...
}
location / {
try_files $uri $uri/ /index.php?altum=$uri;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000; # proxy requests to a TCP socket
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question