WordPress.org

Support

Support » Plugins and Hacks » [Resolved] non-www to www redirect, where to add?

[Resolved] non-www to www redirect, where to add?

  • sysopsavant
    Member

    @sysopsavant

    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/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author AITpro
    Participant

    @aitpro

    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

    Plugin Author AITpro
    Participant

    @aitpro

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

    sysopsavant
    Member

    @sysopsavant

    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.

    Plugin Author AITpro
    Participant

    @aitpro

    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.

    sysopsavant
    Member

    @sysopsavant

    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.

    synsoftglobal
    Member

    @synsoftglobal

    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.

    Plugin Author AITpro
    Participant

    @aitpro

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] non-www to www redirect, where to add?’ is closed to new replies.