WordPress.org

Ready to get started?Download WordPress

Forums

Can't get my site to redirect to www.mydomain.com using htaccess? (1 post)

  1. chickchick
    Member
    Posted 2 years ago #

    Hi,

    I have a plugin running that requires the domain to always have the www. before it. Currently the site shows fine if you go to either http://www.mydomain.com or mydomain.com but for the plugin i need to make whatever you type there redirect to always having the www. present. I've tried to do this in my htaccess file but it doesn't seem to work, when i type mydomain.com it just stays on mydomain.com and doesn't redirect. In my general settings in wordpress, both urls are set to http://www.mydomain.com too.

    What exactly should be the entire code in my htaccess file? I've found a few suggestions to add code but maybe i'm adding it in the wrong place or duplicating something?

    This is what i have currently:

    # BEGIN WordPress
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yoursite.com
    RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
    RewriteRule ^index\.html$ http://www.yoursite.com/ [R=301,L]
    # END WordPress

    Can anyone help?
    Thank you!!

Topic Closed

This topic has been closed to new replies.

About this Topic