Jump to content

Lowercase all file/folder names


son

Recommended Posts

To combat the issues arrising from users entering folder and/or file names with uppercase letters (I only use lowercase) I included a file at top of web pages as:

$trailed = $_SERVER['REQUEST_URI'];	if (preg_match('/[A-Z]/', $trailed)) 	{  	$trailed = strtolower($trailed);  	header('HTTP/1.1 301 Moved Permanently');   	header('Location: http://'. $_SERVER["SERVER_NAME"] . $trailed);  	exit;	}

However, it shows 404 error when I uppercase a letter for testing for example. I also tried:if (preg_match('/[[:upper:]]/', $trailed)) but also does not work. I am open to any solution. Tried few via .htaccess, but also no luck (and no access to config file)...Any ideas?Son

Link to comment
Share on other sites

Just a couple things to try.Try echoing the value of 'http://'. $_SERVER["SERVER_NAME"] . $trailed and see if it's what you expect. Try entering that value directly in your URL bar and see how your server responds.

Link to comment
Share on other sites

Just a couple things to try.Try echoing the value of 'http://'. $_SERVER["SERVER_NAME"] . $trailed and see if it's what you expect. Try entering that value directly in your URL bar and see how your server responds.
Thanks, Deirdre's Dad. I tried this earlier on and this showed the link ok (as long as I entered it correctly in lowercase obviously). Not sure what is not working in my script correctly...Son
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...