2
不確定這是否可行,但我期望做的是讓用戶定向到完全相同的目錄和文件,而不管它們來自哪個特定的URL路徑從。設置.conf文件以允許URL中的「通配符」
例如,我想test.mysite.com/person1
和test.mysite.com/person2
來到相同的索引頁面。
我的.conf(Nginx的)一些僞代碼:
server {
listen 80;
server_name test.mysite.com/person1;
location/{
root /home/testing/public_html;
index index.html;
try_files $uri $uri/ /index.php?$args;
port_in_redirect off;
}
我可以這樣做:
server {
listen 80;
server_name test.mysite.com/*; //Something here that indicates wildcard
location/{
root /home/testing/public_html;
index index.html;
try_files $uri $uri/ /index.php?$args;
port_in_redirect off;
}
的這個整個的一點是,我要提供「個人「網址給那些包含他們名字的人:test.mysite.com/person1
。我將使用javascript來獲取URL(「person1」)的獨特部分,並使用它來通過PHP提供自定義內容等。
本質上,我不希望URL的最後部分更改我從中提供索引文件的目錄。
謝謝。
你可以僅僅刪除路徑和具有test.mysite.com。使用該位置來做通配符:) –
@ScottGreenup因此,如果有人來到'test.mysite.com/person1',它將與來test.mysite.com或test.mysite的人一樣。 COM/person2'?你是什麼意思的:「使用該位置做通配符」 – jonmrich
對不起 - 我誤解了你試圖達到的目標。你想讓'test.mysite.com/*'都使用相同的索引頁嗎? –