logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Redirect www to non-www
Author
thekylesouza



Joined: 29 Jan 2016
Posts: 4
Location: Houston, TX, USA

PostPosted: Wed 03 Feb '16 18:28    Post subject: Redirect www to non-www Reply with quote

I am trying to redirect www.landlinenews.com to landlinenews.com. I began by editing the .htaccess file in the root of the website; this is a WordPress site so there was already one with a couple things in it. I have tried about twenty different variations of these two lines:
RewriteCond %{HTTP_HOST} ^www.\landlinenews\.com$ [NC]
RewriteRule ^(.*)$ http://landlinenews.com/$1 [R=301,L]

The full file contents are:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.landlinenews\.com$ [NC]
RewriteRule ^(.*)$ http://landlinenews.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

What am I doing wrong?
If there is a way to do this outside the .htaccess file I am open to that as well.
Back to top


Reply to topic   Topic: Redirect www to non-www View previous topic :: View next topic
Post new topic   Forum Index -> Apache