Forum » The Geeks Corner » Website WordPress - Help » How to redirect www URLs to non-www

How to redirect www URLs to non-www

  • 1 157
    How to redirect www URLs to non-www?
    (THE LINKS ARE NOT CONNECTED TO ANY REAL WEBSITES)
    You can redirect all of the requests for www.your-website.com domain to your-website.com
    By modifying your website's .htaccess file. You have to add the following lines in the
    beginning of the file so that the redirection is properly set up:

    You can copy & paste this test just change the www.your-website.com and your-website.com to you websites name.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.your-website.com [NC]
    RewriteRule ^(.*)$ http://your-website.com/$1 [L,R=301]

    This is what it looks like on my beast-usa.com website:


    You can edit the .htaccess file using the File Manager in cPanel or download and edit using a FTP like FileZilla or Ipswitch.
    If you download and edit you can use any text editor like notepad, notepad++...

    It's a good idea to keep the original file just in case so save a copy of the original. :)
    Download and edit and before you upload the edited version rename the original something like this htaccess-12-30-2018.

    From now on, when someone accesses your website http://www.your-website.com that visitor will be redirected to http://your-website.com automatically.

    Any questions as always just ask.
    Thermaltake Core V71, Water cooled, Raystorm Waterblock, 270 GPH Pond Pump, 5 Gallon Reservoir, Asus Rampage v Extreme (Bios 3101), Intel i7-6950X Extreme Edition @4000MHZ, 64 gigs Crucial Ballistix Tractical DDR4-3000 15-15-15-33 CR2, EVGA RTX 2080 TI XC, Hard Drives Crucial M550's Raid-0, Crucial SSD 1TB gig, 2 Western Digital 5TB 128meg cache, 2 Seagate 4TB 256meg cache, Corsair 1050 watt SINGLE RAIL, OS LINUX Xubuntu 18.04.2 x64
    This post was edited by beast-usa at December 31, 2018 12:45 AM PST
      December 30, 2018 1:30 PM PST
    1