• what does this code do from my .htaccess?

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

    Also, my site is on a shared server where I host many websites, so it is located in public_html/website1/

    The .htaccess file noted above is in this “website1” root, and it is the only code in this file.

    At the public_html/ (server root) I have another .htaccess which has my permalink code.

    What is the proper location for the .htaccess given this scenario, and are there any type of override rules, i.e. if the server root rules contradict the website root rules, which one wins?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    That code forces the domain name to have a “www” in front of it. If you go to https://domain.com, then you get redirected to https://www.domain.com instead.

    If you’re using WordPress, such code is not really necessary, as it handles www vs. non-www internally, using Canonical Permalinks.

    Thread Starter meegwell

    (@meegwell)

    Thanks. So this code, which is located at my server root (above the wp site in question), is controlling the permalinks and redirects (ie 404 for access outside of WP folders/files):

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘what is this? (in .htaccess)’ is closed to new replies.