• My website is loaded not in the root but inside folder ‘ff’ under root.
    If I use the url “www.footprintsforever.com” the site loads fine and the url defaults to: https://footprintsforever.com/ff/

    If I do not use the www prefix, and only use ‘footprintsforever.com”, the site doesn’t come up. it says ‘error in database connection’

    Again, if I use the same url without the www but with the folder path of ‘ff’ as in ‘footprintsforever.com/ff” , the site comes up fine.

    Can someone help me please.

Viewing 3 replies - 1 through 3 (of 3 total)
  • If I were in your place, I would first deal with setting things either for www or for non-www, then see what I have:

    # Rewrite non-www to www
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]
    # Rewrite www to non-www
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
    RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]

    Full instructions here, if you need them:
    https://forum.ait-pro.com/forums/topic/htaccess-redirect-www-to-non-www-htaccess-redirect-non-www-to-www/#post-1723

    Thread Starter Samit

    (@samitb)

    This is my present .htaccess file :

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?footprintsforever.com$
    RewriteRule ^(/)?$ ff [L]

    RewriteEngine On
    RewriteBase /ff/
    RewriteRule ^index\.php$ – [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    ——-CAn you please guide me on what changes to make … ?

    Disclaimer: I am not a coder — I only know how to copy-and-paste!

    Here is what I would likely try in your case:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    # footprintsforever.com
    RewriteBase /ff/
    # Rewrite non-www to www
    RewriteCond %{HTTP_HOST} ^footprintsforever\.com$ [NC]
    RewriteRule ^(.*)$ https://www.footprintsforever.com/$1 [R=301,L]
    # continue default WordPress
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    # add whatever this might do
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    # send domain to index.php
    RewriteRule ^index\.php$ - [L]
    </IfModule>
    # END WordPress

    In my own case, I only ever let BulletProof Security write my .htaccess and that is what I would suggest if the above does not work.

    https://codex.www.ads-software.com/htaccess

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Site doesn't work without 'www'’ is closed to new replies.