Google’s WMT tools is seeing my site as 2 different sites so I want to implement a 301 redirect from non www to www. The main site www.mysite.com is built using Flash and a folder that contains the wordpress blog is held seperatly in www.mysite.com/blog/.
In the WordPress folder there is a .htaccess file with the following script which doesn’t look right as there are 2 RewriteRules and RewriteCond entries. Should I remove 1 of them or are they both needed?
Why is !-f and !-d in there – what do they do?
Also should my main Flash site have its own .htaccess file for the 301 non-www to www?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Do not remove any of the above rules. They are fine & required. In fact, I would suggest you to add this as well:
From rewritecond apache docs :
-f
,-d
&-l
are variants of CondPatterns. Instead of real regular expression strings.if prefixed by an exclamation mark (‘!’) it leads to negate their meaning. i.e.
!-f
means is not a regular file.For redirecting from
non www
towww
urls use this in your.htaccess
in yourDocumentRoot
:R=301
is for permanent redirect