Convert Uppercase To Lowercase In Htaccess ยป  Show posts from    to     

Icy Phoenix


English Chit Chat - Convert Uppercase To Lowercase In Htaccess



Gianni PB [ Fri 12 Mar, 2010 20:31 ]
Post subject: Convert Uppercase To Lowercase In Htaccess
how can I redirect some links in lowercase in .htaccess?

RedirectMatch 301 ^/folder/(.*?)\.php$ http://www.site.it/folder/($1)/artista.php


($1) in lowercase


example:

from: /folder/ADAMS.php
to: /folder/adams/artista.php




Mighty Gorgon [ Sun 14 Mar, 2010 09:46 ]
Post subject: Re: Convert Uppercase To Lowercase In Htaccess
Only using htaccess is a bit tough... or at least I don't know how to do that... you should ask Apache specialists.

In cases like this I personally use PHP code... I redirect all requests to a php file which then parse the address and redirect where I want to.


Gianni PB [ Sun 14 Mar, 2010 10:59 ]
Post subject: Re: Convert Uppercase To Lowercase In Htaccess
Thanks MG, I found an other way.

I create this file that modify all files I want to redirect to.

Code: [Hide] [Select]
$path = "./";
$dir_handle = @opendir($path) or die("Can't open $path");

while ($file = readdir($dir_handle))
if($file[0]!=".")
{
$fp = fopen($file, "w");
if(!$fp)
die ("Error");
fwrite($fp, '<? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.pugliabaila.it/discografie/" . strtolower(substr($_SERVER[\'PHP_SELF\'], 13, -4)) . "/artista.php" ); ?> ');
$fp = fclose($fp);
}
closedir($dir_handle);


Mighty Gorgon [ Thu 25 Mar, 2010 10:36 ]
Post subject: Re: Convert Uppercase To Lowercase In Htaccess
That was exactly what I was suggesting... PHP redirect.

Glad you solved.




Powered by Icy Phoenix