嗨im有问题,而在nginx中设置htaccess规则。 我的htaccess是:
htaccess的规则是:
RewriteEngine ON RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L]
我已经这样转换它:
if (!-f $request_filename){ set $rule_0 1$rule_0; } if (!-d $request_filename){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite /.* /index.php/$request_uri last; }
我已经读过,如果nginx是邪恶的,但我不明白这些规则。 我正在尝试设置的应用程序是:
http://products.cogzidel.com/airbnb-clone/
现在规则是很有用的,当我们尝试访问pipe理区域。 我们通过在url中写入/pipe理员来访问它,规则将这个作为index.php的input,我们login到这个。 但是在应用这个规则后,我在日志中看到错误404即将到来。 让我提到,nginx的vhost正在重新加载正确的这个规则后,我已经添加了这个规则在服务器领域和放化区也是工作
例如,如果你看看wordpress博客(一个相当全面的例子) http://wiki.nginx.org/WordPress,你会看到这样的:
location /wordpress { try_files $uri $uri/ /wordpress/index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(/wordpress)(/.*)$; }
这是说“直接在/ wordpress中尝试文件,否则传递给index.php处理”。
非常感谢您提供关于尝试文件的想法。 我工作过,并在位置input这个块:try_files $ uri $ uri / /index.php;
它的工作,而不是我可以访问http://my.url.com/administrator
进一步下面提到的堆栈链接是最好的理解尝试文件,这也帮助了我。
https://stackoverflow.com/questions/17798457/how-can-i-make-this-try-files-directive-work