簡體   English   中英

將目錄 htaccess 代碼轉換為 nginx conf 文件的語句

[英]Convert directory htaccess code in to statement for nginx conf file

I am trying to get a database rewrite to work from an htaccess directory statement to an nginx server on centOS7.. We know it works from the php argument from the db such as /UBA/reports/index.php?type=b&name=league_100_home

有人可以幫我們翻譯一下需要在 nginx conf 文件中為 domain.ssl.conf 添加什么才能正常工作嗎? 文件所在的文件夾位於 /public/UBA/reports/

我們嘗試了對 nginx 轉換器站點的 htaccess,但沒有成功,並且 conf 文件無法使用 nginx 重新啟動。 下面的代碼是目錄 /public/UBA/reports/ 中的重寫規則,它使 apache 服務器重寫和工作。 謝謝!

報告 URL 路徑來自 dbconfig.php 文件,其中 $reports_url_path = "/UBA/reports/";

RewriteOptions MaxRedirects=1
RewriteRule ^leagues/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=b&name=$1' [L]


RewriteRule ^box_scores/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=e&name=$1' [L]
RewriteRule ^coaches/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=g&name=$1' [L]
RewriteRule ^game_logs/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=f&name=$1' [L]
RewriteRule ^history/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=h&name=$1' [L]
RewriteRule ^leagues/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=b&name=$1' [L]
RewriteRule ^players/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=d&name=$1' [L]
RewriteRule ^teams/(.*)\.html$ '[%REPORTS_URL_PATH]index.php?type=c&name=$1' [L]

我們通過以下代碼反復試驗解決了這個問題:

rewrite ^/UBA/reports/box_scores/(.*)\.html$ /UBA/reports/index.php?type=e&name=$1 last;
rewrite ^/UBA/reports/coaches/(.*)\.html$ /UBA/reports/index.php?type=g&name=$1 last;
rewrite ^/UBA/reports/game_logs/(.*)\.html$ /UBA/reports/index.php?type=f&name=$1 last;
rewrite ^/UBA/reports/history/(.*)\.html$ /UBA/reports/index.php?type=h&name=$1 last;
rewrite ^/UBA/reports/players/(.*)\.html$ /UBA/reports/index.php?type=d&name=$1 last;
rewrite ^/UBA/reports/teams/(.*)\.html$ /UBA/reports/index.php?type=c&name=$1 last;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM