它在/etc/nginx/sites-available/default 中会是什么样子? 我用的是nginx/1.6.0
<Directory "c:/wamp/www/ProjectName">
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
</Directory>
我试过:
location /ProjectName {
try_files $uri $uri/ /ProjectName/index.php?r=$request_uri;
}
它似乎几乎可以工作,但如果我有带问号的网址: http://ProjectName.dk/Test/site/getPerson?Id=369 我得到错误?
问题是 nginx conf 还应该添加什么?
最佳答案
找到解决方案:
try_files $uri $uri/ /ProjectName/index.php?r=$query_string;
现在它与问号一起使用。
关于.htaccess - 将 Apache 转换为 Nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25077798/