GWIOD – what htaccess code goes in the website root htaccess file?

Home Forums BulletProof Security Free GWIOD – what htaccess code goes in the website root htaccess file?

Tagged: ,

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
  • #30664
    AITpro Admin

    BPS will already create the correct GWIOD htaccess code/root htaccess file code with the correct RewriteBase so you just need to add the non-www to www rewrite htaccess code in BPS Custom Code.  Nope.  You would not add anything additional to the index.php file path.  BPS will automatically create the correct root htaccess file.  BPS will NOT create the “site” root htaccess file for a GWIOD site, which is your hosting account root folder and htaccess file.  That htaccess file is the one you are creating manually.  BPS creates the GWIOD website’s root htaccess file (not the site root htaccess file) for you automatically.

    Here is the logic so that you can see how and why things work the way they do.
    RewriteBase means rewrite rules based on the root folder name.  If you have a root htaccess file in your hosting account root folder then the root folder path is:  / and the RewriteBase is also:  /.
    A primary domain website or addon website also uses a RewriteBase of: / because the domain is seen as a root domain or aliased to the primary domain.
    A WordPress GWIOD site is treated like a subdomain site or a subfolder site.
    Example subdomain site folder, url and RewriteBase:  /subdomain/,, RewriteBase /subdomain/
    Example subfolder site folder, url and RewriteBase:  /subfolder/,, RewriteBase /subfolder/


    Thanks ait-pro – OK, much clearer! Though I’ll probably have to keep re-reading this post as a reminder!

    I’d thought of the public_html root .htaccess rewrite base path as sort of guiding the domain to the subfolder, hence it needed to show the path to it (which I now understand to be incorrect), rather than reflect it’s own path.

    So to ensure i haven’t totally screwed it all up in my WP site, I’ve deleted my custom code and rerun the setup wizards – checked what’s in the current htaccess file and then only added the redirects from non-www to www and resaved of course.

    Thanks again for your patience and help.


    ahhh, looking more closely at my non-www to www redirects I just realised i ‘m combining non-www to www AND domain name alias redirects into the same code, like this:

    RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC]
    RewriteRule ^(.*)$$1 [R=301,L]
    RewriteCond %{HTTP_HOST} ^mysite\$ [NC]
    RewriteRule ^(.*)$$1 [R=301,L]
    RewriteCond %{HTTP_HOST} ^myalias-domian\$ [NC]
    RewriteRule ^(.*)$$1 [R=301,L]

    Firstly… Is this possible to combine the 2 things?!?

    Or should it be done totally separately in the wp .htaccess file or via cpanel alias redirects or via Google webmaster tools?

    I’ve tested it via cPanel, so if I unlock the root htaccess file and then add in the alias redirects in cPanel I get this code in my public_html root htaccess (not my wp site root as it’s in it’s own folder):

    RewriteCond %{HTTP_HOST} ^mysite\.co\.nz$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.mysite\.co\.nz$
    RewriteRule ^/?$ "http\:\/\/mysite\.com" [R=301,L]

    Should I copy this into my subfolder site (GWIOD) htaccess too or instead of in the root? If so into the rewrite box or the bottom box? Or will it work best from the main public_html root file?

    I’ve searched the forum but can only find redirects for site migration or for replacement site content, so perhaps it’s not necessary here?

    Thank you.

    AITpro Admin

    This should answer all of your questions. You can do any redirects that you want as long as the htaccess code that is redirecting somewhere else is located on the site that is going to redirect to another site.  Example:  If someone clicks or uses an URL that goes to: and on that site you have htaccess redirect code that redirects to: then the user will be redirected to the URL. Your htaccess redirect code must go on the site where you are redirecting from. Most likely you will want to add that redirect code in BPS Custom Code.


    Thanks again – yes that sorts it out!

    Cheers, j

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.