Rewrite issue with duplicate wordpress post

flash nginx-forum at nginx.us
Thu Jan 6 15:26:41 MSK 2011


Wordpress automatically adds a "-2" or "-3" to the end of a post with a
duplicate title. For some reason, nginx is dropping that number off of
the end of the url

for example - it is rewriting this

example.com/air-conditioning/wholesale-air-jordans-air-force-4

to this

example.com/air-conditioning/wholesale-air-jordans-air-force

I thought that this may be a wordpress error but I put a
print_r($_SERVER['REQUEST_URI']) line in the index.php file and the "-4"
was already removed before it even tried to load any wordpress files.


Centos 5.5
Nginx 0.8.53

conf file



user  nginx;
worker_processes  8;
worker_rlimit_nofile 8192;

error_log   /var/log/nginx/error.log error;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
    use epoll;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local]
"$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;
	
    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;
    server_tokens   off;
    gzip            on;
    gzip_static     on;
    gzip_comp_level 5;
    gzip_min_length 1024;
    keepalive_timeout  5;
    limit_zone   myzone  $binary_remote_addr  10m;
    server_name_in_redirect	off;
    client_max_body_size 	64M;
    # Load config files from the /etc/nginx/conf.d directory
    include /etc/nginx/conf.d/*.conf;
    deny 		209.190.5.34;

    server {
        limit_conn   myzone  10;
        listen       80;
        server_name  _;
	index index.php;
	root /home/example/public_html;

	location / {
            set                 $memcached_key  $host$uri;
            memcached_pass      127.0.0.1:11211;
            default_type        text/html;
            error_page          404 502 = @dynamicContent;
        }

	location @dynamicContent {
            try_files     $uri $uri/ @Wordpress;
        }

        location @Wordpress {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_param  SCRIPT_FILENAME 
/home/example/public_html/index.php;
            include        fastcgi_params;
            fastcgi_param  SCRIPT_NAME      /index.php;
        }

        location ~ \.php$ {
            try_files      $uri @Wordpress;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME 
/home/example/public_html$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
}


Thanks

Flash

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,164051,164051#msg-164051




More information about the nginx mailing list