Skip to main content
Home
Blog

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Knowledge Base
  4. How-To

How do redirect www using mod_rewrite?

By ongetc , 26 February, 2017

With rewrite rules, it is very simple, please use this code below but do change the domain to your domain name.

Note: If you want to redirect to www then just reserve the logic

In your .htaccess

RewriteEngine on
RewriteOptions inherit

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

Forums
How-To

Reseller hosting (free)

Hosting24 (w/ ssh)

A2 Hosting

Monthly archive

  • September 2009 (14)
  • October 2009 (11)
  • January 2010 (2)
  • June 2010 (3)
  • October 2011 (1)
  • March 2012 (1)
  • July 2012 (1)
  • February 2017 (564)
  • March 2017 (5)
  • April 2017 (2)

Pagination

  • 1
  • Next page

Popular content

Last viewed:

  • F3Site
  • How to do normal URL with Zend Framework?
  • CuteNews
  • Piwigo
  • Geeklog
  • PDF pages counting using VB script.
  • Diem
  • DotNetNuke
  • widgEditor
  • hosting24.com

User login

  • Reset your password