WordPress.org

Ready to get started?Download WordPress

Forums

BulletProof Security
[resolved] non-www to www redirect, where to add? (8 posts)

  1. sysopsavant
    Member
    Posted 1 year ago #

    I've had some issues with one site lately at http://www.poppameth.com not redirecting to the www version of the site when the prefix is left off. I'd like to insert the redirect code into my .htaccess to make sure it always redirects, but I'm not sure whether to manually add it or to add it via custom code in the rewrite loop. Any input on which is correct and how the code should be written in the custom code section?

    http://wordpress.org/plugins/bulletproof-security/

  2. AITpro
    Member
    Plugin Author

    Posted 1 year ago #

    I believe that is covered in the Video Tutorial link that you will find on the BPS Custom Code page. Also there is an issue with caching plugins and adding www to non-www and vice versa .htaccess code.

    This thread covers the basics and also the caching issue:
    http://wordpress.org/support/topic/non-www-301-redirect?replies=20

  3. AITpro
    Member
    Plugin Author

    Posted 1 year ago #

    Is this issue/problem resolved? If so, please resolve this thread. If not, please post a status update. Thank you.

  4. sysopsavant
    Member
    Posted 1 year ago #

    It's not exactly resolved yet but on standby. Hostgator flushed the server side cache and now the site is redirecting correctly. I'm assuming they already have a 301 redirect set up for this by default. For some reason the server side cache was stuck back on the 19th of July. If it occurs again I'll try the code injection to see if that will resolve it. This has happened in the past with Hostgator but the problem resolved itself within an hour or two. This time it was several days. I'm thinking this may be a hostgator problem instead of a plugin issue.

    Thanks for the input though. At least I know how to do it now if it becomes necessary.

  5. AITpro
    Member
    Plugin Author

    Posted 1 year ago #

    I'm sure this issue is related to the ongoing Brute Force Login attacks, which are causing a wide range of problems - Folks unable to access or login to their sites, 324 Browser errors, DNS and Cloud issues. These are the most common issues that we are aware of. In general the amount of traffic that is being generated by these automated attacks is extremely high and is causing worldwide problems for Hosts. ugh.

  6. sysopsavant
    Member
    Posted 1 year ago #

    Quite possible. I've had some issues with Cloudflare as well. Most of my site issues started when Hostgator moved me to a new server. My sites have all gotten slower and developed periodic issues with caching.

  7. synsoftglobal
    Member
    Posted 2 months ago #

    You just need to one small changes in "wp_options" table:
    Change "siteurl" & "home" URL in "wp_options"
    and it will redirect to www version always.

  8. AITpro
    Member
    Plugin Author

    Posted 2 months ago #

    Actually you need to use non-www to www .htaccess rewriting code within the WordPress rewrite loop to do this properly. In addition to changing your WordPress General Settings.

    1. Copy the WP REWRITE LOOP START .htaccess code below to this Custom Code text box: CUSTOM CODE WP REWRITE LOOP START: Add www to non-www/non-www to www code here

    IMPORTANT NOTE: If your WordPress site is installed in a subfolder then add the folder name to the RewriteBase line of code. Example: WordPress is installed in a folder named "myblog". The RewriteBase would be RewriteBase /myblog/.

    Rewrite non-www to www

    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^domainname\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]

    ...Or...

    Rewrite www to non-www

    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.domainname\.com$ [NC]
    RewriteRule ^(.*)$ http://domainname.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]

    2. Click the Save Root Custom Code button.
    3. Go to the Security Modes page, click the Create secure.htaccess File AutoMagic button and activate Root folder BulletProof Mode again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic