1

Есть такие правила для apache:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^rtest.html$ /wp-content/plugins/exchangebox/sitepage/test.php [QSA,L]
RewriteRule ^blackping.html$ /wp-content/plugins/exchangebox/sitepage/blackping.php [QSA,L]
RewriteRule ^logout.html$ /wp-content/plugins/exchangebox/sitepage/logout.php [QSA,L]
RewriteRule ^curscron.html$ /wp-content/plugins/exchangebox/sitepage/curscron.php [QSA,L]
RewriteRule ^sitemap.xml$ /wp-content/plugins/exchangebox/sitepage/sitemap.php [QSA,L]
RewriteRule ^exportxml.xml$ /wp-content/plugins/exchangebox/sitepage/exportxml.php [QSA,L]
RewriteRule ^exporttxt.txt$ /wp-content/plugins/exchangebox/sitepage/exporttxt.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Один из редиректов для nginx:

location = /curscron.html {
  rewrite ^(.*)$ /wp-content/plugins/exchangebox/sitepage/curscron.php break;
}

Вместо выполнения /wp-content/plugins/exchangebox/sitepage/curscron.php, появляется окно, где предлагается сохранить файл.

2
  • Откройте codex, там есть набор правил для nginx. У вас не подключен upstream, потому отдаётся файл 3 окт 2019 в 20:27
  • Хм... при прямом обращении /wp-content/plugins/exchangebox/sitepage/curscron.php, все норм. При rewrite сохраняется curscron.html, но с кодом curscron.php.
    – gemuz
    4 окт 2019 в 21:08

1 ответ 1

0

Используя мой хитрозадуманный конвертер Apache->NGINX:

index index.php;
rewrite ^/rtest.html$ /wp-content/plugins/exchangebox/sitepage/test.php last;
rewrite ^/blackping.html$ /wp-content/plugins/exchangebox/sitepage/blackping.php last;
rewrite ^/logout.html$ /wp-content/plugins/exchangebox/sitepage/logout.php last;
rewrite ^/curscron.html$ /wp-content/plugins/exchangebox/sitepage/curscron.php last;
rewrite ^/sitemap.xml$ /wp-content/plugins/exchangebox/sitepage/sitemap.php last;
rewrite ^/exportxml.xml$ /wp-content/plugins/exchangebox/sitepage/exportxml.php last;
rewrite ^/exporttxt.txt$ /wp-content/plugins/exchangebox/sitepage/exporttxt.php last;
location / {
    try_files $uri $uri/ /index.php$is_args$args;
}
1
  • Да, именно так все отлично стало работать!
    – gemuz
    7 окт 2019 в 20:18

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.