How to help the .htaccess file optimization. How to create the file. .htaccess - SEO solve many problems
htaccess for SEO - best tips
HTACCESS hypertext Access This is a file that can solve many SEO problems faced frequent site administrator or SEO professional. This article will describe only the basic functions of .htaccess that can significantly improve your site's performance and position in search engine results. For example one of the most frequent and not every average consumer is solvedSEO problem is dubbed the site's content, which is formed not because the site's pages, repeats the same information, but because one and the same page can be opened with a different address. This is just one example, but they can be much more, and the solution to this problem is the .htaccess file creation and insertion of a special code..htaccess - SEO will solve many problems
1. How to create a .htaccess file?
2. .htaccess help determine what address will be available for your page.
3. .htaccess „clean "create url.
4. How to remove the slash „/“.
5. .htaccess code for GZIP (speed boot).
6. With .htaccess Manage your browser cache
7. The .htaccess file can do 301 redirects.
8. .htaccess to set the home page.
9.Remove the "category" in the url.
10. Use .htaccess file generator friendly.
11. Folder protection.
12. Protect .htaccess file
1. How to create a .htaccess file?
Create .htaccess file is very simple, just need to see once and instantly learn. First, open the Notepad text editor. It is important to save exactly as shown: in quotation marks and plus do not miss the point before .htaccess.- File – SaveAs -- Faile name: „.htaccess“:
2. htaccess help determine what address will be available for your page
As I mentioned a common problem when a page is available with different URLs. For example:- http://www.mypage.com
- http://mypage.com
- http://mypage.com/
- http://www.mypage.com/index.html
- http://mypage.com /index.html
How to make typing any of the following options would be open only to a single URL.
- http://www.mypage.com/
- RewriteEngine on
RewriteCond %{HTTP_HOST} ^mypage\.com$ [NC]
RewriteRule ^(.*)$ http://www.mypage.com/ $1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www. mypage.com/ $1 [R=301,L]
- RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mypage\.com$ [NC]
RewriteRule ^(.*)$ http://mypage.com/ $1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http:// mypage.com/ $1 [R=301,L]
I think the correct URL should be the web, but most importantly, to avoid duplication of content and the page would be achieved with a single URL. Also remember that all links both internal and external use a URL you set as a basic English is called canonical.
[ads-post]
3. .htaccess"Clean" create url
When we talk about the concept of how to clean the url is probably not at all clear. It is meant to remove limbs .html, .php, etc.For example: http://www.mypage.com/blog/article.html do to show the following: http://www.mypage.com/blog/article
And you can do with this code (this will remove the .html and .php to eliminate the need to adjust the code and save .php instead of .html)
- RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
4. How to remove the slash „/“
If you notice that your site can be accessed with the back of the dash and tilt without it. In this situation it is also necessary for concern, because the search engine robots can re-evaluate how different pages, and this will cause duplicate content issue. To remove this / hyphen in the quotation marks at the end of your URL must use the following code:- RewriteEngine On
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1
5. .htaccess code for GZIP (speed boot)
You probably already know that the site / page loading speed is also influenced by the SEO results, and to speed up page loading speed can also use the .htaccess file with SPECIAL code. Gzip - server app that compresses and decompresses page of your site then automatically when needed. Thus one should take this opportunity to activate Gzip through .htaccess file in which to insert the following code- AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml
text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
6. With .htaccess Manage your browser cache
With the special code can set the browser cache (called cache) use. It is the same if the visitor returns to your site and then charge the service faster as will the visitor's browser cache (if she has not a visitor's browser automatic cache cleanup). So the .htaccess file, you can set the maximum cached files (such as images, HTML, CSS, JavaScrip etc.) Validity (time counted in seconds, so one day is 86 400 S)..)Example set of 30-day cache expiration time:
- # 30 days
<filesMatch “.(jpg|jpeg|png|gif|swf|ico)$”>
Header set Cache-Control “max-age=2 592 000, public”
</filesMatch>
# 30 days
<filesMatch “.(xml|txt|js)$”>
Header set Cache-Control “max-age=2 592 000, proxy-revalidate”
</filesMatch>
# 30 days
<filesMatch “.(html|htm|css|php)$”>
Header set Cache-Control “max-age=2 592 000, private, proxy-revalidate”
</filesMatch>
7. The .htaccess file can do 301 redirects:
For example if someone changed the URL of the page, but wishing that the old URL to redirect visitors to the new need to do so (the old page: /puslapis.html, a new page: a new-old page.html ps page URLs are relative reference ie without http: / /www.mypage.com)- ## 301 Redirect Old File
Redirect 301 /page.html http://www.mypage.COM/new-page.html
8. .htaccess to set the home page
..htaccess file you can set any file that will serve as the start page. For example the default file will be a key to open the index.html or index.php, but if you want to set another must use the following code (and the code can help determine who will be the first to open or index.html or index.php).The example set other Home:
- DirectoryIndex NEXTPAGE.html
9. Remove the "category" in the url
Some CMS - content management system automatically creates an additional word of URLs that you do not want to see. And if you would like to hide NOT ACCEPTABLE category (http://www.mypage.com/category/page.html show as http://www.mypage.com/page.html) then you can use the following code:- RewriteRule ^category/(.+)$ http://www.MYPAGE.COM/$1 [R=301,L]
10. Use .htaccess file generator:
http://www.htaccessredirect.com/11. Folder protection
The .htaccess file can determine the appropriate file protection so that they could enter only with a specific IP address. For example, you can set the number of IP addresses, where you usually you are located to protect the access to the site CMS (content management). For this you need to create a new .htaccess file and put in the right directory / folder.- order deny, allow
deny from all
allow from xx.xx.xx.xx
- ## Block users by IP
order allow,deny
deny from xxx.xxx.xxx.xxx
allow from
12. Protect .htaccess file
Most servers have a set of file protection, but the protection is never too much, therefore we recommend to upload the following code:- <Files .htaccess>
order allow,deny
deny from all
</Files>
COMMENTS