WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Redirection] add www to URL (6 posts)

  1. garry12
    Member
    Posted 5 years ago #

    One of the features listed for the plugin is being able to add www to URL's (or rather, force a redirect). Just wondering if someone could let me know what I actually have to do to get this working.

    Thanks!

  2. thehegemonist
    Member
    Posted 5 years ago #

    Have you figured this out yet? I'm trying to do the same thing.

  3. garry12
    Member
    Posted 5 years ago #

    Still haven't got this, can anyone help?

  4. fencepost
    Member
    Posted 5 years ago #

    Redirection mostly works with the content of the URL after the domain name, so I'm not sure how you'd do it unless you're using it to modify your .htaccess file.
    This guy has a nice little writeup: http://www.trevorfitzgerald.com/2007/03/force-www-using-an-htaccess-301-redirect/
    To summarize if his site goes away, you need to

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

    The "%{HTTP_HOST} ^" on the second line says basically "if an inbound connection starts with my domain name without www, match this rule." The next line rewrites the incoming request by changing the inbound host name and adding the rest of the original URL onto it.

  5. cuban_cigar
    Member
    Posted 5 years ago #

    fencepost

    That code certainly makes it happen in 2.6, but its looking like no in 2.8, does anyone have functional code or a workaround to the bug?

  6. John Godley
    Member
    Posted 5 years ago #

    The .htaccess rule above is not related to WordPress and so will work regardless of WordPress version.

    Redirection has an option when configuring modules to canonicalize your domain.

Topic Closed

This topic has been closed to new replies.

About this Topic