Forum Moderators: phranque
I have big big problem witch my blog in wordpress :
Good url :
http://www.example.com/toto/
http://www.example.com/toto/tata/
http://www.example.com/toto/tata/lolo/
Bad url :
http://www.example.com/toto/20/ = 200
http://www.example.com/toto/tata/43/ = 200
http://www.example.com/toto/tata/33/ = 200
http://www.example.com/toto/tata/lolo/88/ = 200
When you write number after last slash this is duplicate content :(
I test many solution but i dont find good solution.
If one people find me nice solution by .htaccess fore send 301 or 404 i paid 200usd by paypal
See you
RewriteCond %{REQUEST_URI} ^(.*)[0-9](.*)$
RewriteRule . http://www.example.com%1/%2 [R=301,L]
Actualy is ok for me but if im use :
www.example.com/2008/09/08/sample-post/ is doesnt work but this is good url
and this is bad url :
www.example.com/2008/09/08/sample-post/666/
RewriteCond %{REQUEST_URI} ^([0-9]{4})/([0-9]{2})/([0-9]{2})/([A-Z])/([0-9])/?$
RewriteRule . http://www.example.com%1 [R=301,L]
And my normal urls never end with numbers. But i have this type of url
www.example.com/2008/09/08/sample-post/
www.example.com/7-sample-post/
www.example.com/page-toto/page-tata/page-titi/
But you don't need a RewriteCond anyway.
RewriteRule ^([0-9]{4}/[0-9]{2}/[0-9]{2}/[A-Z\-]/)[0-9]+/?$ http://www.example.com/$1 [NC,R=301,L]
Jim
All wordpress blog have a same problem
This is good url :
[wordpress.org...]
[wordpress.org...]
http://www.example.com/toto/tata/lolo/
http://www.example.com/2008/09/08/sample-post/
This is bad url :
[wordpress.org...]
[wordpress.org...]
[wordpress.org...]
http://www.example.com/toto/tata/lolo/12345/
When the url is finish by random number this is duplicate content and this is of all blog work on wordpress. But the number in url is good (Ex : 2008 & 09 & -262). The problem is final number (Ex : /777/ & /666/ & /98765/ & /12345/)
This is my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# Problem number
RewriteRule ^([0-9]{4}/[0-9]{2}/[0-9]{2}/[A-Z\-]/)[0-9]+/?$ http://www.example.com/$1 [NC,R=301,L]
# Case sensitive
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^(.*)$ lcaseurl\.php\?url=\/$1 [L,NC]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
But this rule is doesent work :
RewriteRule ^([0-9]{4}/[0-9]{2}/[0-9]{2}/[A-Z\-]/)[0-9]+/?$ http://www.example.com/$1 [NC,R=301,L]
I test this solution :
RewriteRule ^(.*)[0-9](.*)$ http://www.example.com/$1 [NC,R=301,L]
But is not good solution because is broke good url witch number (Ex :http://wordpress.org/development/2008/05/birthday-party/) but is work for this bad url (http://www.example.com/toto/tata/lolo/12345/) :(
In example.com/.htaccess:
RewriteRule ^(([a-z0-9_\-]/)+)[0-9]+/?$ http://www.example.com/$1 [NC,R=301,L]
The only identifying features for the "bad" URL-path-part to be removed is that it is the final URL-path-part and that it is composed only of numbers.
Jim