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

  • February 2019 (1)
  • December 2020 (224)
  • January 2021 (168)
  • March 2021 (1)

Pagination

  • Previous page
  • 2

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