# Rewrite issue with duplicate wordpress post

**URL:** <https://www.ruby-forum.com/t/rewrite-issue-with-duplicate-wordpress-post/201388>\
**Category:** NGINX\
**Created:** [January 6, 2011, 1:28pm UTC](https://www.ruby-forum.com/t/rewrite-issue-with-duplicate-wordpress-post/201388 "2011-01-06T13:28:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 6, 2011, 1:28pm UTC](https://www.ruby-forum.com/t/rewrite-issue-with-duplicate-wordpress-post/201388/1 "2011-01-06T13:28:08Z")

</div>

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](http://example.com/air-conditioning/wholesale-air-jordans-air-force-4)

to this

[example.com/air-conditioning/wholesale-air-jordans-air-force](http://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:

> **[Rewrite issue with duplicate wordpress post](https://forum.nginx.org/read.php?2,164051,164051#msg-164051)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![flash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f475e1/32.png) [@flash](https://www.ruby-forum.com/u/flash)\
**Post date:** [January 12, 2011, 11:33am UTC](https://www.ruby-forum.com/t/rewrite-issue-with-duplicate-wordpress-post/201388/2 "2011-01-12T11:33:00Z")

</div>

Anyone?

Where would I start to troubleshoot this?

Posted at Nginx Forum:

> **[Re: Rewrite issue with duplicate wordpress post](https://forum.nginx.org/read.php?2,164051,165533#msg-165533)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![flash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f475e1/32.png) [@flash](https://www.ruby-forum.com/u/flash)\
**Post date:** [January 12, 2011, 1:46pm UTC](https://www.ruby-forum.com/t/rewrite-issue-with-duplicate-wordpress-post/201388/3 "2011-01-12T13:46:02Z")

</div>

On 1/12/2011 1:31 PM, flash wrote:

> Where would I start to troubleshoot this?

Turn on debug mode and you will catch activity.
