background preloader

Htaccess

Facebook Twitter

6 .htaccess Tricks for Better WordPress SEO & Security. Here are six htacccess tricks that will help improve the security and SEO quality of your WordPress-powered site. We do this using .htaccess to establish canonical URLs for key peripheral files, such as your robots.txt, favicon.ico, and sitemap.xml files. Canonicalization keeps legitimate bots on track, eliminates malicious behavior, and ensures a better user-experience for everyone. On the menu: Before making changes.. The .htaccess code in this post is designed to work when placed in the web-accessible root .htaccess file of your domain. Before making any changes to this file, make a good backup and keep it on hand just in case. 1. Help bots and visitors find your robots.txt file no matter what. . # CANONICAL ROBOTS.TXT <IfModule mod_rewrite.c> RewriteBase / RewriteCond %{REQUEST_URI} ! To use this code, replace example.com with your own domain and include in your web-accessible root directory.

RewriteCond %{REQUEST_URI} ! Alternate Method: 2. RewriteCond %{REQUEST_URI} ! 3. 4. 5. 5 Fun and Practical Htaccess Solutions. 16 Useful .htaccess Tricks and Hacks For Web Developers. The .htaccess files (Hypertext Access file) is a very powerful configuration tool on Apache web server. The Apache web server has a number of configuration options that are available to the server administrator. The .htaccess is a simple ASCII text file placed in your website root directory. You can create and edit an .htaccess file using a text editor like notepad. Here in this blog post I have come up with useful 16 tips and hacks to configure your web server. As a configuration file .htaccess if a very powerful and a slight syntax error can result in a severe malfunction of your server. 1. ErrorDocument 401 /error/401.phpErrorDocument 403 /error/403.phpErrorDocument 404 /error/404.phpErrorDocument 500 /error/500.php 2.

SetEnv TZ America/Houston 3. Allow from alldeny from 145.186.14.122deny from 124.15 If you use the whole IP or a part of the IP to block and add the new ones in a new line. 4. 5. ServerSignature EMailSetEnv SERVER_ADMIN default@domain.com 6. 7. 9. 10. 11. 12. 13. Stupid htaccess Tricks. Welcome to Perishable Press! This article, Stupid htaccess Tricks, covers just about every htaccess “trick” in the book, and is easily the site’s most popular offering.

In addition to this htaccess article, you may also want to explore the rapidly expanding htaccess tag archive. Along with all things htaccess, Perishable Press also focuses on (X)HTML, CSS, PHP, JavaScript, security, and just about every other aspect of web design, blogging, and online success. If these topics are of interest to you, I encourage you to subscribe to Perishable Press for a periodic dose of online enlightenment ;) General Information [ ^ ] .htaccess Definition 1 ^ Apache server software provides distributed (i.e., directory-level) configuration via Hypertext Access files. Commenting .htaccess Code ^ Comments are essential to maintaining control over any involved portion of code. Important Notes for .htaccess Noobs ^ As a configuration file, .htaccess is very powerful. Performance Issues ^ [S=x] [E=variable:value] 21 very useful htaccess tips & tricks. htaccess tips tricks | ViralPatel.net. Apache web servers has a great way to manipulate information using .htaccess files. .htaccess (hypertext access) is the default name of a directory-level configuration file that allows for decentralized management of web server configuration.

The .htaccess file is placed inside the web tree, and is able to override a subset of the server’s global configuration; the extent of this subset is defined by the web server administrator. The original purpose of .htaccess was to allow per-directory access control (e.g. requiring a password to access the content), hence the name. Nowadays .htaccess can override many other configuration settings, mostly related to content control, e.g. content type and character set, CGI handlers, etc. Following are few very useful htaccess tricks. 1. Custom Directory Index Files DirectoryIndex index.html index.php index.htm You can change a default index file of directory by using above snippet in your htaccess file. 2. ErrorDocument 404 errors/404.html 3. 4. 6. 7.

The Definitive Guide to htaccess Techniques: Do’s and Don’ts - Noupe Design Blog. Aug 10 2009 Of all the elements of web design and coding, htaccess can be one of the most intimidating. After all, it’s an incredibly powerful tool and one that has the potential to completely break your site if you’re not careful. Below are a dozen basic htaccess techniques and tips to get you started. They’re not nearly as intimidating as many people expect, and if you study the code for a few minutes, I’m sure you’ll quickly grasp exactly how they work and why. After that are a few bewares and don’ts for working with htaccess to help keep you out of trouble, and some more resources for further working with htaccess. 12 Basic htaccess Tips: 1. .htaccess on a Linux Apache server makes it easy to create your own custom error pages.

ErrorDocument 401 /401.php ErrorDocument 403 /403.php ErrorDocument 404 /404.php ErrorDocument 500 /500.php (Obviously you should replace the “/500.php” or whatever with your own file path and name.) 2. Options All -Indexes 3. DirectoryIndex news.html 4. 5. 6. 7. 8.