iT邦幫忙

0

NGINX網址優化設定問題?

com 2019-11-30 22:47:162251 瀏覽

我的NGINX目前設定如下

location /modules/news/ {
	try_files $uri /modules/news/view.tag.php?var=$request_uri;
}

當網址是https://www.xn.com.tw/modules/news/view.tag.php/3 時modules/news/view.tag.php可以$_GET['var'] = view.tag.php/3我只希望$_GET['var'] = 3,如果不使用PHP過濾字串,
NGINX設定要如何改才能只讓3被GET?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1
froce
iT邦大師 1 級 ‧ 2019-12-01 01:25:34
最佳解答

這樣?

location ~ /public/(\d+)/? {
	try_files $uri /public/index.php?var=$1;
}

我要發表回答

立即登入回答