Forums

[resolved] Canonical (3 posts)

  1. richarduk
    Member
    Posted 2 years ago #

    How do I resolve http://mysite.com to http://www.mysite.com ?

    The index page will happily go to the latter option but inner pages won't. They all do the first option.

    Why has WP been set up this way ? Is it easy to change it round? (htaccess or a plugin?)

    Thanks,

    Richard

  2. richarduk
    Member
    Posted 2 years ago #

  3. richarduk
    Member
    Posted 2 years ago #

    To get WordPress to create permalinks that contain www paste the following into an .htaccess file, and place this file in the root of your website (make sure you're not accidentally redirecting secure server traffic to an insecure server?)

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

    With thanks to: http://www.webweaver.nu/html-tips/web-redirection.shtml

    To prevent WP overwriting .htaccess rules: http://www.redcardinal.ie/webdev/11-06-2007/stop-wordpress-overwriting-htaccess/
    Also see: http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html

Topic Closed

This topic has been closed to new replies.

About this Topic