web statistics

WWW. FORWARDING WITH APACHE

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!

Pages: « First   1   Last »

Share del.icio.us Digg it reddit
Current tags

apache forwarding
Rate this tutorial

5

Log In to rate this tutorial
Comments
no comments Add Comment
Log In to post your comments

Google PageRank Checker - From PageRankr
 
&nsbp;