DrQuincy Posted 10 hours ago Posted 10 hours ago This is something I've just noticed when settingup some redirect. Let me use an example on the processwire.com site: https://processwire.com/docs/ https://processwire.com/dOcs/ This both load the same page. Processwire does make the canonical tag lowercase. I just wondered though, is there a system-wide way of directing all requests that aren't files to be lowercase: www.site.com/files/I_am_a_PDF.pdf -> fine www.site.com/folder/I-am-a-Page -> 301 redirects to www.site.com/folder/i-am-a-page Thanks. 🙂
Robin S Posted 4 hours ago Posted 4 hours ago Some site-wide JS? // Get the current URL const currentUrl = window.location.href; // Convert to lowercase const lowercaseUrl = currentUrl.toLowerCase(); // Only update if there are uppercase letters if(currentUrl !== lowercaseUrl) { // Use replaceState to update URL without reloading the page window.history.replaceState(null, '', lowercaseUrl); }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now