您好,我正在尝试将这些重写为 nginx 格式,但无法取得任何进展。你能帮我为 nginx 重写这些吗?
# Rewrite any calls to *.html, *.json, *.xml, *.atom, *.rss, *.rdf or *.txt if a folder matching * exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !public/
RewriteCond %{DOCUMENT_ROOT}/public/$1.$2 !-f
RewriteRule (.+)\.(html|json|xml|atom|rss|rdf|txt)$ $1/ [L]
# Add a trailing slash to directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.|\?)
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ([^/]+)$ $1/ [L]
# Rewrite any calls to /render to the image parser
RewriteCond %{REQUEST_URI} render/
RewriteRule ^render/. app/parsers/slir/ [L]
# Rewrite any calls to /* or /app to the index.php file
RewriteCond %{REQUEST_URI} /app/$
RewriteRule ^app/ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php?/$1/ [L,QSA]
# Rewrite any file calls to the public directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.+)$ public/$1 [L]
我已经尝试过了,但它没有用。
location public/ {
}
location ~ (\.|\?) {
}
location ~ (.*)/$ {
}
location public/ {
}
location / {
if (!-e $request_filename){
rewrite (.+)\.(html|json|xml|atom|rss|rdf|txt)$ /$1/ break;
}
if (!-e $request_filename){
rewrite ([^/]+)$ /$1/ break;
}
if ($request_uri ~ "render/"){
rewrite ^/render/. /app/parsers/slir/ break;
}
if ($request_uri ~ "/app/$"){
rewrite ^/app/ /index.php break;
}
if (!-e $request_filename){
rewrite ^/(.*)/$ /index.php?/$1/ break;
}
if (!-e $request_filename){
rewrite ^(.+)$ /public/$1 break;
}
}
当我尝试这个并输入我的网址时。它下载一个文件。