- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業務經營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯網協會理事單位
- 安全聯盟認證網站身份V標記
- 域名注冊服務機構許可:滇D3-20230001
- 代理域名注冊服務機構:新網數碼
環境
Ubuntu 14.04+Nginx+MySQL。所有程序都是通過apt-get安裝的,所以Nginx的配置文件路徑在/etc/nginx/sites-available/default。
解決方法
定位到Nginx配置文件的如下部分:
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
加入下面的代碼:
if (!-e $request_filename)
{
rewrite ^/myapp/(.*)$ /myapp/index.php?s=$1 last;
break;
}
正則的寫法
解決這個問題的時候,看到了好幾種解決方案,光正則就看到了好幾個,也不知道到底哪個是最標準的,本人正則也不是很熟,先記錄下來,以后慢慢研究:
正則1:
rewrite ^/MYAPP/(.*)$ /MYAPP/index.php/$1 last;
正則2:
rewrite ^(.*)$ /index.php?s=$1 last;
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP