Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandanmajeske/9ab89246b7a341a1f7bf to your computer and use it in GitHub Desktop.
Save brandanmajeske/9ab89246b7a341a1f7bf to your computer and use it in GitHub Desktop.
URL rewrite to lower with JavaScript
<script type="text/javascript">
var URL=document.location;
//This makes the URL become a string, without it, an error would
//occur.
URL+="";
if(URL.toLowerCase() != URL){ //Check if the URL needs modified
//If so, then replace it.
document.location.replace(URL.toLowerCase());
//I used replace because I didn't want the user to hit the
//back button and then hit the URL that they came from, thus
//returning them to the same place.
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment