Support » Fixing WordPress » Multiple .htaccess files on one website

  • Resolved ajhauser

    (@ajhauser)


    Hello,
    I have WordPress installed in a directory called “wordpress” for my website located at: hauserdesigngroup.com

    (blog here: hauserdesigngroup.com/wordpress/

    You will notice when you click that link that it bumps you over to http://WWW.hauser...

    I have this file in place to add WWW with a 301 redirect to every page:

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

    However, once in the “wordpress” directory, this doesn’t work – and I am guesing it’s not compatable with the .htaccess for re-writing URLs. I mean if you go to “hauserdesigngroup.com/wordpress/”, it doesn’t get adjusted to “WWW.hauserdesigngroup.com/wordpress/”.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]
    </IfModule>

    Is there a way to combine these two?
    I would just like to make sure the blog section adds “WWW” to every URL like the rest of the site.

    Thanks very much.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Add this into your .htaccess file in you /wordpress directory with this in it

    RewriteEngine on
    Options FollowSymlinks
    rewritecond %{http_host} ^ hauserdesigngroup.com [nc]
    rewriterule ^(.*)$ http://www. hauserdesigngroup.com/$1 [r=301,nc]

    Should solve it I, pretty sure its the best way.

    Jason

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    No need to add or remove the www in .htaccess or add 301 redirects. Add the www prefix to both URLs in Dashboard>>Settings and save.

    Then get rid of everything else in .htaccess other than the standard WP permalinks block.

    Awesome – thank you both! The second method mentioned did the trick for all the pages. My only other question is whether or not the first method would work for EVERYTHING, including images. For example, without adding anything to the .htaccess file I can still load this without the “www” added:

    http://hauserdesigngroup.com/wordpress/wp-content/uploads/2012/09/example-of-a-great-qr-code-4.jpg

    But maybe that doesn’t matter either way? Meaning, maybe 301’s wouldn’t redirect image links?

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    Nothing is needed to .htaccess for the www issue. Simply add www in WP settings.

    That image link works with and without the www

    Thanks for all the help! Really appreciate it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Multiple .htaccess files on one website’ is closed to new replies.