I'm having some trouble in transformation of htaccess from apache to nginx.
actual htaccess rule:
options +followsymlinks
RewriteEngine On
RewriteCond $1 !^(images|system|themes|css|js|flex|slider|rss|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^(.*) /index.php?$1 [L]
this rule set is used in expression engine 1.7
my current solution :
location / {
index index.php;
try_files $uri $uri/ @ee;
}
location @ee {
rewrite ^(.*) /index.php?/$1 last;
}
location /index.php {
include fastcgi_params;
set $script $uri;
set $path_info $uri;
if ($args ~* "^(/.+)$") {
set $path_info $1;
}
fastcgi_pass fastcgi-upstream_${server_name};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
}
location ~* \.php$ {
include fastcgi_params;
fastcgi_pass fastcgi-upstream_${server_name};
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
but it not reflexting 100% the same thing as in htaccess.
You can use the location block in Nginx. This will redirect all your request to index.php.
location / {
rewrite ^/(.*) /index.php?$1 break;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.