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:

  • TheHostingTool
  • How to embed video in your Drupal content?
  • Seagull
  • Go.Kryo
  • Perl Editor
  • KevLinDev - Tutorials
  • DAV Explorer
  • Textism
  • Routing or rewriting, MVC missing link!
  • MosModule: How to embed video in content?

User login

  • Reset your password