How important is htaccess for SEO? How much effect can htaccess have on your SEO? Should webmasters apply special attention to ensuring htaccess has correct rules in? For sites that are running on the same IP, should we use IP canonicalization. Is it a must?
As you've mentioned, its important to use canonical URLs, so enforcing that in htaccess is important. Another thing is making sure important bots are not blocked. So Google, Bing, Baidu, and other major search engine bots should be allowed. Another thing is to not cause problems for browsers accessing and displaying your site properly. *I've had this issue myself. Last but not least, you want to make sure is to handle 404 errors and redirects properly, so duplicate content and other issues don't pop up.
Right. Canonical URLs and Canonical IP's binded to the domain. I'm not using any blocking rules. By not having a rule to allow Google bots etc is the rule to allow them. They naturally have access so no need to give them access or state access unless I deny it access. Here is what I'm using in one of my htaccess files. I'm seeing good results and think that htaccess is very overlooked but should contain some rules for locking your site down to making it run better. One thing which is important is setting whether your site shows the www. or not. So you can specify it using. RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] RewriteRule ^(.*)$ http:// example.com/$1 [L,R=301] To reverse it and force www: RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http:// www. example.com/$1 [L,R=301,NC] If you're on a shared IP (shared hosting) or using a dedicated IP. Use this to canonicalize the domain to the IP. Replace xxx with your IP. RewriteCond %{HTTP_HOST} ^xxx\.xxx\.xxx\.xx RewriteRule (.*) http:// mydomain.com/$1 [R=301,L] //Standard WP rewrite rules # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress //Add compression to file types AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml AddOutputFilterByType DEFLATE application/javascript application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html Header append Vary User-Agent env=!dont-vary //Tell browser to store files until they expire. Makes page load faster not having to rerequest files. ExpiresActive On ExpiresDefault A300 ExpiresByType image/x-icon A2592000 ExpiresByType application/x-javascript A3600 ExpiresByType text/css A3600 ExpiresByType image/gif A604800 ExpiresByType image/png A604800 ExpiresByType image/jpeg A604800 ExpiresByType text/plain A300 ExpiresByType application/x-shockwave-flash A604800 ExpiresByType video/x-flv A604800 ExpiresByType application/pdf A604800 ExpiresByType text/html A300 //Cache Certain file types, saves bw and speeds up load time # 1 YEAR <FilesMatch "\.(ico|pdf)$"> Header set Cache-Control "max-age=29030400, public" </FilesMatch> # 1 MONTH <FilesMatch "\.(jpg|jpeg|png|gif|swf|css|js)$"> Header set Cache-Control "max-age=2689743, public" </FilesMatch> # 2 DAYS <FilesMatch "\.(xml|txt|html|php)$"> Header set Cache-Control "max-age=172800, proxy-revalidate" </FilesMatch> //Denying access to all open and admin directories Options All -Indexes <Files wp-config.php> order allow,deny deny from all </Files> <Files ~ "^.*\.([Hh][Tt][Aa])"> order allow,deny deny from all satisfy all </Files> //State error page location. RewriteEngine on ErrorDocument 404 /404.php That's only an example. I use other stuff in other htaccess files for other sites and I've seen some other peoples sites htaccess file and they use all sorts of rules and things as well. I think its underated and overlooked by many webmasters and should be one of the first things you set when you first create a site such as the DNS zones in the Apache config file, if you have access to it. Just as important as robots.txt and sitemap.xml if not more when it comes to SEO. Of course, you can have a virtually blank htaccess file and still have good rankings. I guess some of the biggest sites don't even need to use them right?
In fact, A .htaccess plays quite an important role in the way your website is ranked by the search engines. This file can be used to allow and block users by domain or IP address.It is also use in redirecting URLs
htaccess file is acronym for Hypertext Access. It is a configuration file used by Apache-based web servers that controls the directory. These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable or disable additional functionality and features that the Apache Web Server software has to offer. htaccess is useful in many ways: Custom Error Pages: .htaccess file additionally allows you to create custom error pages for your site. Most common error is ‘Error 404 : Page Not Found’ when a link is broken and cannot be found. To make a page look friendlier and to provide more information to the site visitor you can use the .htaccess file to create custom error pages. Design an error page that you want to showcase whenever your blog gets Page Not Found error and provide its location in the .htaccess file. ErrorDocument 404 /customError.html Mime Types: Sometime our site features some application files but our server is not set up to deliver those files. In this case, we need to add MIME types to your Apache server in the .htaccess file with the following code. AddType text/css .css AddType text/x-component .htc AddType application/x-javascript .js AddType application/javascript .js2 AddType text/javascript .js3 AddType text/x-js .js4 AddType text/html .html .htm AddType text/richtext .rtf .rtx AddType image/svg+xml .svg .svgz AddType text/plain .txt AddType text/xsd .xsd AddType text/xsl .xsl AddType text/xml .xml AddType video/asf .asf .asx .wax .wmv .wmx AddType video/avi .avi AddType image/bmp .bmp Protect wp-config.php with .htaccess file WP-config.php is the most crucial file in your blog. It allows data storing and retrieving. The information about username, password, host and database name are present in your wp-config.php. Protecting your wp-config.php should be your prior concern. Below code helps you to do so: <Files wp-config.php> order allow,deny deny from all </Files> Restrict Spam visitors and Block them by using IP Address When your site gets popularity and it attracts huge visitor base, it increases chances to be attacked by spammers or annoying visitors. You need to take proper action by stopping them to spam your site. Below code will allow you to restrict certain visitors: <Limit GET POST> order allow,deny deny from {IP Address of the Denied Visitor1} deny from {IP Address of the Denied Visitor2} allow from all </Limit> Restricting other users to access Admin area In our blog, we have many roles like editor, author, subscriber and author having partial access. But you need to restrict them to use your admin area. To do this, you can add the following code to the .htaccess file and fill your IP address – order deny,allow allow from {your IP Address} deny from all There are also few more properties that we can configure in htaccess file. You can read my full article here - http://catchupdates.com/what-is-htaccess-file/
Good advice thank you. Does it help SEO though? I thought ht access only for protecting your site form being hacked by denying access to vulnerable directories.
Hi, yes it helps in SEO as well. From SEO perspective, it helps in - 1) To set Browser Cache to increase site speed (thus helping us to decrease bounce rate for better SEO) 2) Solving The Canonical Website Address 3) Enabling gZIP compression 4) Creating SEO-Friendly URLs 5) Solving 404 'Page Not Found' errors or other errors with custom error pages.