Support » Fixing WordPress » Can someone PLEASE verify this htacess write for me?

  • Hi All,

    I noticed one on my site don’t have an htaccess file and in the process of creating one in particular to force www version of my site.

    Anyway, put this rewrite together and wondering if this would work:

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

    Options -Indexes +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301]

    RedirectMatch 301 ^/blog/(.*)$ http://blog.example.com/$1
    # END WordPress

    Does this look right? Thanks so much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The site currently doesn’t have an .htaccess file? That would imply that your Permalinks are still at the default (you can check that at Settings -> Permalinks) or you are on a Windows Server.

    If your Permalinks settings are really at Default then there are big chunks of your example file that you don’t want. However, if you change to non-default permalinks then you’ll get an .htaccess file created.

    If you’re on a Windows server the odds are good that the file won’t be used…

    Which is really just a long way to say we need more info 🙂

    Thread Starter mwelch

    (@mwelch)

    Hi Chris_K,

    Thanks for the response. Oops didn’t even occur to me to create the custom permalink first.

    Ok, so changed it to:
    /%category%/%postname%

    It created the htaccess file which includes:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    I added the rewrite script as listed above and it all seems to be working perfect!

    Thanks so much for the tip!!

    Thread Starter mwelch

    (@mwelch)

    I actually have a followup question if you don’t mind lending me your expertise 😉

    This rule works for this site but not for another one I was trying to add the rewrite to.

    When I try to add the rewrite to newbizblogger.com and type in http:// newbizblogger.com I redirected to a domain not found page and get this message:

    Search Results for “www.newbizblogger.comwp-content”

    The only difference in the two sites, is that this site has an addition rule that was created by my W3 Total Cache plugin.

    When I deactivate the plugin and did the rewrite it worked perfectly.

    Is there any around having the rewrite work and still utilize this plugin? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can someone PLEASE verify this htacess write for me?’ is closed to new replies.