1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Force lowercase

Discussion in 'Site & Server Administration' started by JohnScott, Jan 6, 2016.

  1. #1
    Website whatever.com has links to it with whatever.com/Widgets and whatever.com/widgets and some search engine treats these as different URLs. I want whatever.com/Widgets to be whatever.com/widgets when somebody clicks on it. How do I do this? With hundred of pages. Basically just want all to be lowercase.
     
    JohnScott, Jan 6, 2016 IP
  2. th.sigit

    th.sigit Well-Known Member

    Messages:
    178
    Likes Received:
    32
    Best Answers:
    1
    Trophy Points:
    135
    #2
    Hi John,

    The most simple method is here:

    http://www.askapache.com/htaccess/rewrite-uppercase-lowercase.html.

    You can simply copy and paste the code from that page, and see if it will work.

    Note:
    • I never have a need for this, I am sure it will work, but I do not know it this will satisfy your need (another source mention that .htaccess method will slower your server's respond).
    • I use keywords "htaccess change uppercase to lowercase", so probably there is a better solution than that.
     
    th.sigit, Jan 6, 2016 IP
    JohnScott and sarahk like this.
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    If you're using some kind of CMS (which I really hope you are), you could force the links being displayed, whether it's in the menu, post-links, etc. to be lower case by modding the underlying code (if it's php, strtolower() around the outputted url, for instance). However, if this isn't a CMS, that might not be ideal.
    Depending on the amount of links, you could do a search and replace of all that contains upper-case letters, both in the files and in the database.
     
    PoPSiCLe, Jan 7, 2016 IP
    th.sigit likes this.
  4. JohnScott

    JohnScott Notable Member

    Messages:
    867
    Likes Received:
    285
    Best Answers:
    0
    Trophy Points:
    250
    #4
    Thanks, will try this.
     
    JohnScott, Jan 7, 2016 IP
  5. th.sigit

    th.sigit Well-Known Member

    Messages:
    178
    Likes Received:
    32
    Best Answers:
    1
    Trophy Points:
    135
    #5
    If you're using some kind of CMS, particularly Wordpress:

    Which brings me this:
    https://wordpress.org/plugins/force-lowercase-urls/
    it has not been updated for 2 years, thus, with all Wordpress updates it probably will work or not.

    Which reminds of these:

    https://wordpress.org/plugins/redirection/
    This plugin will automatically redirect old URLs to new URLs when you change your post/page URL, and keep them in the database. It also records all 404 pages, and give an option to redirect those 404 pages to the correct page, to another page, or to homepage. Very useful.

    I do not remember if this plugin can automatically correct wrong URL to the correct URL (for instance, if you change UPPERCASE to lowercase prior to installing this plugin), but it is worthy to try.

    https://wordpress.org/plugins/search-regex/
    This plugin helps you change anything you want in the database for Wordpress output. I can't remember if this plugin makes the changes directly to the tables (so, when you uninstall the plugin, the changes will stay) or if it keeps its own tables (so, when you uninstall/deactivate this plugin, the changes will be restored), but it is quite useful, too.

    However, the latter requires us to learn a bit about regex, which is good actually. I use it along with this tool site: https://regex101.com/ for testing.
     
    th.sigit, Jan 7, 2016 IP
  6. JohnScott

    JohnScott Notable Member

    Messages:
    867
    Likes Received:
    285
    Best Answers:
    0
    Trophy Points:
    250
    #6
    It's not a CMS. :(
     
    JohnScott, Jan 7, 2016 IP
    th.sigit likes this.
  7. th.sigit

    th.sigit Well-Known Member

    Messages:
    178
    Likes Received:
    32
    Best Answers:
    1
    Trophy Points:
    135
    #7
    You can still keep the advice, bwahahahha
     
    th.sigit, Jan 7, 2016 IP
    JohnScott likes this.
  8. JohnScott

    JohnScott Notable Member

    Messages:
    867
    Likes Received:
    285
    Best Answers:
    0
    Trophy Points:
    250
    #8
    Thanks ;)
     
    JohnScott, Jan 7, 2016 IP