| Share | Tweet |
What exactly is .htaccess file…?
When a crawler or user requests a webpage, the web server checks .htaccess file. This .htacces file gives certain instruction for your request including error code, redirection, and security issues.
If you want to create an .htaccess file, open a notepad and save as .htaccess with no extension
Implement 301redirection:
Redirects single page …
Redirects 301 oldfolder/oldfilename .htm http://www.yourname.com/oldfilename.htm
Redirect all files from your domain
redirectMatch 301 ^(.*)$ http://www.yourdomain.com
redirectMatch permanent ^(.*)$ http://www.your-domain.com
Redirect http://yourdomain.com to http://www.yourdomain.com
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
Redirect .htm pages to .php pages
RewriteEngine on
RewriteBase /
RewriteRule (.*).htm$ /$1.php