• home
  • forum
  • my
  • kt
  • download
  • www. Forwarding with Apache

    Author: 2007-09-07 13:12:29 From:

    Step 1 - The code
    Ok, in this mini tutorial I am going to give you the code to use apache to redirect your site when ever someone uses www. it will go to yoursite.com instead of www.yoursite.com which can be useful in many different ways

    Ok so open up your .htaccess file and put this in it first:

    RewriteEngine on

    Which basically means turn the apache rewrite engine on..

    Now after you have put that in it put this in aswell:

    Options +FollowSymlinks
    RewriteCond %{HTTP_HOST}//s%{HTTPS} ^www.(.*)//((s)on|s.*)$ [NC]
    RewriteRule ^ http%3://%1%{REQUEST_URI} [L,R=301]

    This basically sets a rule that when the user visits the server in www. mode to forward to non www.

    As simple as that!

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Administration (7)
      Editing Files (2)
      Getting Started (8)
      Installation (8)
      Linux and other OSs (10)
      Miscellaneous (10)
      Networking (8)
      Security (9)
      Shells and Utilities (14)
      System Monitoring (5)
      Troubleshooting (1)
      X Windows (6)

    New

    Hot