• 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 https://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 ^(.*)$ https://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 ^(.*)$ https://www. hauserdesigngroup.com/$1 [r=301,nc]

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

    Jason

    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.

    Thread Starter ajhauser

    (@ajhauser)

    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:

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

    Thread Starter ajhauser

    (@ajhauser)

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

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

    That image link works with and without the www

    Thread Starter ajhauser

    (@ajhauser)

    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.