Support » Plugin: BulletProof Security » 301 redirect – Bulletproof Security

  • Resolved elmatinal


    Hello! I’ve been using the Bulletproof Security plugin for a while now, and am very happy with it. However, I realized I needed a 301 redirect, since my domain seems to have two entries on Google (with and without www.).

    I’ve edited the .htaccess (via BPS in dashboard) and it worked fine for a few minutes, then it just stopped working. I went to the dashboard and the 301 redirect code was still in the .htaccess file, but it just didn’t work.

    In fact, it’s still there and I have made no modifications, I just can’t understand why it just worked a few minutes then not anymore.

    This is the code I’ve used:

    RewriteCond %{http_host} ^\.com [nc]
    RewriteRule ^(.*)$$1 [R=permanent,nc,L]

    Of course, I’ve replaced my actual domain name 😛

Viewing 1 replies (of 1 total)
  • Plugin Author AITpro


    You can set the domain name in WordPress Settings >>> General, but if you already have pages out there and you want them to redirect whether they have the www prefix of not you could use either examples below depending on what you want to do. The htaccess code you posted is not valid.

    Permanently redirect all non-www requests to www domain
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    Permanently redirect all www requests to non-www domain
    RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
    RewriteRule ^(.*)$$1 [R=301,L]

    or another way without having to add the host name
    RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
    RewriteRule ^(.*) http://%1/$1 [R=301,L]


Viewing 1 replies (of 1 total)
  • The topic ‘301 redirect – Bulletproof Security’ is closed to new replies.