Enforce Status Code 301 using mod_rewrite

Common Apache rewrite rules do 302 Moved Temporarly redirects which cause spiders such as Google to fail indexing. Common redirect (status code 302)
RewriteEngine On
RewriteRule ^/$ /anypage.html [L,R]

You must return error code 301 to gain the spider’s favour. Therefore, the mod_rewrite configuration directive must be adjusted appropriately. Permanent redirect (status code 301)
RewriteEngine On
RewriteRule ^/$ /anypage.html [L,R=301]

Do not get confused by the L flag it just marks that rule as the last rule to be processed and does not affect the redirect behavior.