Forum Moderators: phranque

Message Too Old, No Replies

Wordpress & url case sensitive

Wordpress & url case sensitive

         

leandre

4:39 pm on Aug 29, 2008 (gmt 0)

10+ Year Member



hello,

I have wordpress blog.

And i have little problem witch google :(

ex : http://www.example.com/toto/tata/

but this url is work and this is duplicate content :

ex : http://www.example.com/totO/tAta/

If you dont understand why :(

jdMorgan

7:32 pm on Aug 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Apache by itself is case-sensitive. But the standard WordPress code in .htaccess rewrites *any* non-existent URL to WordPress. Therefore, the two solutions are:

1) Reject non-existent URLs containing uppercase characters (do not rewrite them to WordPress).
-or-
2) Modify WordPress (or find a plug-in) to redirect case-variant URLs to the proper URL

Jim

leandre

1:19 pm on Sep 1, 2008 (gmt 0)

10+ Year Member



Ok thank you i find a solution :

in .htaccess

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^(.*)$ lcaseurl\.php\?url=\/$1 [L,NC]

<?
// Check if URL is passed as parameter
if(strlen($_GET['url'])){
// Redirect to the lower-case version permanently
header("HTTP/1.0 301 Resource Moved Permanently");
header("Location: ".strtolower($_GET['url'])."");
exit();
}
// If not URL passed return a 404
header("HTTP/1.1 404 Not Found");
?>

But i dont have solution for this :

Good url :
http://www.example.com/toto/
http://www.example.com/toto/tata/

Bad url :
http://www.example.com/toto/20/ = 200
http://www.example.com/toto/tata/43/ = 200

I have problem only witch number :(