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

How to redirect www URLs to non-www

  • 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.
    My System:
    Case: Thermaltake Core V71 Tempered Glass.
    Motherboard: Asus Prime TRX40-Pro.
    CPU: AMD Threadripper 3970X@Auto OC.
    Water Block: EK Velocity sTR4 copper & nickel.
    Radiator: Thermaltake Pacific CL429 64mm pure copper.
    Water Pump & Res: 320 GPH Pond Pump, 5 Gallon Reservoir.
    Memory: 64 gigs Corsair Vengeance DDR4-3600 18-19-19-39 CR1.
    Video Card: Asus TUF AMD RX 6900XT OC 16 gigs
    Hard Drives: 1 Crucial 256gig M550, 2 Crucial 2TB SSD's,
    1 WD 10TB 256meg cache, 1 WD 5TB 128meg cache, 2 Seagate 4TB 256meg cache.
    Power Supply: Corsair 1050 watt SINGLE RAIL.
    OS's: LINUX Xubuntu 20.04 LTS x64 and Windows 10 Pro.
    This post was edited by beast-usa (Admin) at December 31, 2018 12:45 AM PST
      December 30, 2018 1:30 PM PST
    1