我试图让数据库重写工作从htaccess目录语句到centOS7的nginx服务器。我们知道它的工作原理是来自db的php参数,如UBAreportsindex.php?type=b&name=league_100_home。
谁能帮我们翻译一下domain.ssl.conf的nginx conf文件中需要添加什么才能正常工作?文件所在的文件夹在publicUBAreports中。
我们尝试了一个htaccess到nginx的转换器网站,没有成功,conf文件也不能用nginx重启。下面的代码是publicUBAreports目录下的重写规则,使apache服务器重写&工作。谢谢
报告的URL路径来自dbconfig.php文件,其中$reports_url_path = "UBAreports"。
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;