我有两个域名 我正在使用www.example.com作为我的正常站点, examp.le使用了URL缩写器。
我有完美的设置www.example.com与所有重写规则。
在www.example.com的web根目录下,有一个名为examp.le的目录。
我希望将所有的stream量redirect到examp.le中的index.php
所以我的问题基本上有两个子问题:
http://examp.le/SOMEURLIDENTIFIER给http://examp.le/index.php?i=SOMEURLIDENTIFIER ? 只需在nginxconfiguration中为主机名称创build新的server实例即可 。 它应该看起来像这样:
服务器{
....
听80;
server_name示例;
root /absolute/path/www.example.com/examp.le; #这是你的1
....
位置 / {
....
如果(!-e $ request_filename){
重写^ /(。*)$ /index.php?=$1 last; #这是你的2
打破;
}
....
}
....
位置〜\ .php $ {#PHP处理
....
}
}