Some Of Important .htaccess Codes
Redirect Non WWW to WWW
RewriteEngine onRewriteBase /RewriteCond %{HTTP_HOST} ^example\.com$RewriteRule ^(.*) http://www.example.com/$1 [R=301]
Redirect index.php to non index.php
RewriteCond %{THE_REQUEST} ^.*/index.phpRewriteRule ^(.*)index.php$ http://www.example.com/$1 [R=301,L]
To Redirect WWW to Non WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
For redirect all index.php url to non index.php in magento (Ecommerce Websites)
RewriteEngine onRewriteBase /RewriteCond %{THE_REQUEST} ^.*/index.phpRewriteRule ^(.*)index.php$ http://www.example.com/$1 [R=301,L]RewriteRule ^index.php/(.*) $1 [R=301,QSA,L]
Changed your Pages from .html to .php
RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
To Redirect One page to Another Page
Redirect /old-index.html http://www.mynewwebsite.com/foldername/new-index.html
PHP Header Redirect
<?php header ('HTTP/1.1 301 Moved Permanently'); header( "http://www.new-website.com" ); ?>
To Redirect One Page to Another Page
Redirect /old-index.html http://www.mynewwebsite.com/foldername/new-index.html
To Start Inner Pages of WordPress Website
# BEGIN WordPress
<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>
# END WordPress