WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] W3 Total cache and www non www not working (4 posts)

  1. dagger77
    Member
    Posted 4 years ago #

    Hi,

    Can anyone help me with this ?

    My website was working find and redirecting non www to www link. but after installing w3 Total cache its working anymore. I wanted to fix it by my self in htccess but no luck
    Can any one fix this : here is my htaccess

    # BEGIN W3 Total Cache
    <IfModule mod_setenvif.c>
    SetEnvIfNoCase Accept-Encoding (gzip) APPEND_EXT=.$1
    </IfModule>
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} \/$
    RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register).php|wp-.*\.php|index\.php) [OR]
    RewriteCond %{REQUEST_URI} (wp-comments-popup\.php|wp-links-opml\.php|wp-locations\.php) [NC]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|wordpress_\[a-f0-9\]\+|wordpress_logged_in) [NC]
    RewriteCond %{HTTP_USER_AGENT} !(bot|ia_archive|slurp|crawl|spider) [NC]
    RewriteCond /home/content/d/a/g/dagger77/html/wp-content/w3tc/pgcache/$1/_default_.html%{ENV:APPEND_EXT} -f
    RewriteRule (.*) wp-content/w3tc/pgcache/$1/_default_.html%{ENV:APPEND_EXT} [L]
    </IfModule>
    # END W3 Total Cache

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Thank you

  2. dagger77
    Member
    Posted 4 years ago #

    any help ?

    thx

  3. dagger77
    Member
    Posted 4 years ago #

    I helped my self...

    here is how for anyone who need it..
    use this code in your htaccess (make sure its on top before anything els)

    RewriteCond %{HTTP_HOST} !^www\.yoursite\.com
    RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]

    this simply change all non www links to www good for SEO and search engines

  4. cosmictap
    Member
    Posted 4 years ago #

    Thanks, Dagger.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.