https://www.icyphoenix.com/viewtopic.php?f=17&t=7028
-----------------------------------
Gianni PB
Fri 12 Mar, 2010 20:31

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


 :cry:  :cry:  :cry:


-----------------------------------
Mighty Gorgon
Sun 14 Mar, 2010 09:46

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

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 linenumbers=false]	$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);[/code]


-----------------------------------
Mighty Gorgon
Thu 25 Mar, 2010 10:36

Re: Convert Uppercase To Lowercase In Htaccess
-----------------------------------
That was exactly what I was suggesting... PHP redirect. :)

Glad you solved.


