Need Help Converting .htaccess to Nginx Configuration File

Kevin Yusharyahya lists at
Tue Jan 5 08:31:28 MSK 2010

Hi all,
I just moved my site from an Apache-based webserver into a Nginx-based
webserver. As a result, all of my site's permalinks are broken. Can
anyone help me convert my .htaccess into Nginx configuration files?
Here's my .htaccess - for your information, I'm just running a simple
WordPress site. The .htaccess is on /, not on some /dir/.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I read some articles in the web and after trying to convert it myself
here's what I get.

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 last;

Is that right? Where should I put that? In
/usr/local/nginx/conf/nginx.conf? I have three sites running in three
domains in the server and I just want this to run at one domain.
Posted via

More information about the nginx mailing list