如何在nginx 0.7.65中编写干净的url htaccess

时间:2013-02-07 11:51:27

标签: .htaccess nginx

我将apache的htaccess转换为nginx后出现404错误,下面是我的htaccess代码

RewriteEngine On
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]

请帮助我,我是在学习

1 个答案:

答案 0 :(得分:1)

编辑你的nginx.conf并在你的vhost

中添加这一行
     location / 
    { 
    if (!-e $request_filename)
    { 
       rewrite ^(.*)$ /index.php?$1 break; 
    } 
    }