Generate custom .htaccess file, a powerful server configuration file used for URL rewrites, SEO 301 redirects, hotlink protection, caching and compression.
If your website is running on an Apache Web Server, there’s a file that can be quite useful called .htaccess. This file allows you to configure your server by redirecting traffic, forbidding hotlinks, rewriting URLs, setting up protection from bots, and more.
.htaccess can be created using any simple text editor. It’s placed in the root directory or any subdirectories and takes complete control over them. Using .htacess is convenient when you have multiple people managing different parts of your website. With .htaccess you’ll be able to let each person manage the directory they’re responsible for. When the use of .htaccess is allowed, Apache server will actually look in every directory and subdirectory for it, whether or not the files are present, and as such, this can affect performance. Before using .htaccess, make sure you actually need it. However, .htaccess also offers an array of directives that can help you prevent potential issues and make your job much faster and easier.
Below are listed the directives that you can configure with our .htaccess Generator Wizard.
Redirect your website from www to a non-www and vice versa. For example, Google differentiates between a www.webhostinggeeks.com and webhostinggeeks.com, treating both as different websites, the redirection done for SEO.
Symbolic links are like shortcuts used to reference to a file or a directory, so that you actually don’t have to copy or move the original.
Compression allows your website to load faster by reducing the size of files before they are sent by your web server. Later on, they are decompressed in a browser as the page loads. There are two methods of compression you can use: GZip or Deflate. Our .htaccess uses the DEFLATE mod, but if that doesn’t work, you might want to you use the Gzip mod.
The use of trailing slashes can bring a lot of confusion, but to put it simply, slashes designate directories, but never files. So /folder/foo leads to a file named foo, while /folder/foo/ leads to a directory named foo. Most of the search engines exclude the trailing slash, which can lead to a “404 not found” error. The solution to this problem is quite simple, you just need to let your server automatically add a trailing slash.
Enabling the use of .htaccess file can pose certain security risks, such as someone accessing it, and consequently, taking control over your web server configuration. In order to avoid such a scenario, you will want to block access to the .htaccess file.
Enabled directory browsing grants access to your files for just anyone, even if you don’t have links listed to the said files. So unless you want a random person getting possession of your files, you should always have directory browsing disabled.
Forbidding hotlinking prevents other websites using your images, and as a result, stealing your bandwidth.
There are so called “bad bots”, they usually serve the purpose of email harvesting, website ripping, spammers etc. .htaccess lets you easily block any of them, and instead when a listed bot tries to access your website, they receive an error. This can greatly reduce the load on your server and save you bandwidth. The .htaccess code our tool generates blocks the most common bots crawling the Internet.
Let’s say you’d like to move your website to a different domain; however, you don’t want to lose your search engine rankings that took time and effort to achieve. In that case, a few lines of code in .htaccess will redirect all your visitors to your new domain name.
If for whatever reason, you want to block someone from accessing your website, it can easily be done in .htaccess. All you’ll need is their IP address.
Your default index page is your website’s homepage. It’s what the server loads upon request, if no other page of the website was specified. The most typical names used for the default page is index.html, index.htm, index.php etc. If, for example, you’ve moved from another host and the file there is named differently, you can change the name of it in .htaccess.