IntroductionSome people might not aware of the power of htaccess, I have 17 htaccess methods in this article which I have used or tested it before, and I think some of them are essential tricks and tips to protect your webserver against malicious attacks and other would able to perform simple tasks efficiently such as redirection and web server optimization. Last but not least, if you have been looking for web hosting services, you might want to have a look at this unlimited web hosting. :)GeneralThe following htaccess will able to help you to achieve simple task such as redirection and web server optimization. 1. Set TimezoneSometimes, when you using date or mktime function in php, it will show you a funny message regarding timezone. This is one of the way to solve it. Set timezone for your server. A list of supported timezone can be found here SetEnv TZ Australia/Melbourne 2. SEO Friendly 301 Permanent RedirectsWhy it's SEO friendly? Nowadays, some modern serach engine has the capability to detect 301 Permanent Redirects and update its existing record. Redirect 301 http://www.queness.com/home http://www.queness.com/ 3. Skip the download dialogueUsually when you try to download something from a web server you get a request asking whether you want to save the file or open it. To avoid that you can use the below code on your .htaccess file AddType application/octet-stream .pdf
AddType application/octet-stream .zip
AddType application/octet-stream .mov 4. Skip wwwOne of the SEO guideline is, make sure there is only one URL pointing to your website. Therefore, you will need this to redirect all www traffic to non-ww, or the other way around. RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.queness.com [NC]
RewriteRule ^(.*)$ http://queness.com/$1 [L,R=301] Read more: Queness
AddType application/octet-stream .zip
AddType application/octet-stream .mov 4. Skip wwwOne of the SEO guideline is, make sure there is only one URL pointing to your website. Therefore, you will need this to redirect all www traffic to non-ww, or the other way around. RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.queness.com [NC]
RewriteRule ^(.*)$ http://queness.com/$1 [L,R=301] Read more: Queness
0 comments:
Post a Comment