简体   繁体   English

将重写规则转换为npox conf for typo3

[英]Convert rewrite rules to nginx conf for typo3

I have the followin rewrite rules. 我有以下重写规则。 They are needed to get CoolURI for typo3 working on an apache server. 他们需要让CoolURI for typo3在Apache服务器上运行。 Now I want to do the same for nginx server. 现在我想为nginx服务器做同样的事情。

RewriteEngine On

RewriteRule ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)$ - [L]
RewriteRule ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/.*$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php

Can anyone help me to convert those to nginx conf? 任何人都可以帮助我将这些转换为nginx conf吗? I found this http://nginx.org/en/docs/http/converting_rewrite_rules.html but I am really new to nginx and cannot figure out how to convert this... 我发现这个http://nginx.org/en/docs/http/converting_rewrite_rules.html但是我对nginx很新,并且无法弄清楚如何转换这个......

Any ideas? 有任何想法吗?

This should work: 这应该工作:

location / {
    index index.php index.html index.htm;
    try_files $uri @rewrite;
}

location @rewrite {
    rewrite ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)$ - last;
    rewrite ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/.*$ - last;
}

You would put this within the server { ... } declaration. 你可以把它放在server { ... }声明中。

I don't use Typo3, so I can't say for certain if it WILL work, but it may just need some basic tweaking. 我不使用Typo3,所以我不能肯定它是否会起作用,但它可能只需要一些基本的调整。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM