简体   繁体   中英

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. Now I want to do the same for nginx server.

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? 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...

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.

I don't use Typo3, so I can't say for certain if it WILL work, but it may just need some basic tweaking.

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.

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