redirect - PHP uppercase to lowercase rewrite optimization? -


I am using this PHP code to redirect uppercase of any form in the lowercase of the URI. There are three exceptions: If there is no redirect in "adminpanel" or "search" in the URI, even if it is already lowercase then there is no redirect

Do you want to improve the function in PHP Looking for a method?

$ trailed = $ _SERVER ['REQUEST_URI']; $ Pos1 = strpos ($ trailed, "adminpanel"); $ Pos2 = strpos ($ trailed, "search"); If ($ pos1 === Wrong & amp; amp; $ pos2 === False & strlen ($ trailed)! == strlen (preg_replace ('/ [AZ] /', '', $ trailed)) {$ Trailed = strtolower ($ trailed); Header ('http / 1.1 301 permanently move'); Header ('location: http: //'. $ _SERVER ["SERVER_NAME"]. $ Trailed); Go out; }

I think this URI will fail to redirect to a mixed case case . What is this intention? Also, if the string component of string component is being compared to line 4 on string 4 and above,

Comments

Popular posts from this blog

iphone - How do I make a UIPickerView in a UIActionSheet -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

MVP, design question -