Close Popup
Report Bug

HTACCESS REDIRECT GENERATOR

On web servers running the Apache Web Server software the .htaccess configuration file can be placed. .htaccess is an abbreviation for Hyper Text access. When this file is placed the Apache Web Server will detect and execute the commands in this file. This file can be used to:

Enter Domain
Do not include www. Domain name only - e.g. yourdomain.com
Select redirect type:

About .htaccess

On web servers running the Apache Web Server software the .htaccess configuration file can be placed. .htaccess is an abbreviation for Hyper Text access. When this file is placed the Apache Web Server will detect and execute the commands in this file. This file can be used to:

  • Alter configuration of Apache Web Server
  • Enable/disable functionality and features
  • Handle redirects
  • Protect passwords
  • Deny access toy visitors by IP address
  • Redirect visitors

There are other additional functions that the .htaccess file can be coded to perform. The name of the file cannot be changed or an extension added to it. In case you change the name or save it with an extension and upload it; it will not be recognized. If you have used a Content Management System like Drupal, Joomla or WordPress you might have encountered this file. You might also have edited it. Some web servers do not allow you to edit it. But you can create your own file and upload it to specific directories.

How to Create .htaccess file

You can create the .htaccess file using a good text editor like TextPad, UltraEdit and Microsoft WordPad. You cannot use Microsoft NotePad. You can enable password protection, redirect to a custom error page if a user fails to login, or redirect to a custom page if an error is encountered by a user. An .htaccess file can contain a single or multiple lines depending upon the functions you want to include in it. You will need to use an FTP (File Transfer Protocol) program to upload the file. Also you must to upload the file in “ASCII” mode. Some FTP programs use “BINARY” as the default to upload files. If that’s the case you must change it to “ASCII”. Upload the file to the directory you want it to reside in. when you look at the files in your website’s directory you might not see it as your web server’s software is probably hiding it.

Error handling

.htaccess file is very useful when it comes to handling errors. Visitors get irritated when they encounter an error message like a 401, 404, 500 message on a website. This is where the .htaccess file can be used to display a friendly message to visitors in case they face any problem in accessing your website.

Redirects

Redirects enable a webmaster to redirect your website’s visitors from one page to another within the website. You can also redirect a visitor to a different website. This is a very handy tool when webmasters don’t want the visitors to view certain pages on the website.

Password Protection

This is probably the most important function that a webmaster might want to incorporate. They don’t want anyone who is not authorized to visit and access the site. For example, you must have a valid user id and password to access your email account. When a password protection is provided a user feels more secure in sharing information on that website. Even the popular social media sites are password protected. To password protect your website you will need to place some instructions in your .htaccess file.

Deny Visitors

Again this function can be incorporated in your website using the .htaccess file. Some sites do not want visitors from certain IP addresses accessing their site. This function is extremely useful in blocking out unwanted visitors. The webmaster can choose which IP addresses to allow visiting the site and from which IP addresses to block visitors. In most cases webmasters allow visitors from a specific range of IP addresses and thus automatically block visitors from any other IP address. Organizations, government agencies use this functionality to block unwanted visitors.

If you come across a number of visits from an unknown site, you can block that site in case you think they may be pinching your CSS files. You can also deny access by referrers.

.htaccess redirect generator

Placing all the commands that webmasters might want in the .htaccess file on the web server requires them to know html code. Yes, the commands for the .htaccess file to execute can be created using a text editor but cannot be placed as a tool.

To perform a redirect from non-www to www or from www to non-www there’s a .htaccess tool available on smallseotools.com. if you want the tool to generate the code to include in your website’s .htaccess file, navigate to smallseotools.com from your search browser. On the site scroll down to the .htaccess redirect generator tool icon and click on it. It has two options;

  • Redirect from www to non-www
  • Redirect from non-www to www

The default selection is the first option. Enter your domain name and press ‘get your code’ button. There’s a captcha that will require verification. Once you have done that the code generated will be displayed in the Results box. Now you can copy the code from here and paste it in your .htaccess file.

After successfully updating the .htaccess file it will perform the redirect function. Now the website visitors will be redirected to another site seamlessly,

Conclusion

The .htaccess file is an extremely useful tool for webmasters to control their websites. They can give user friendly messages in case of an error, incorporate password restrictions, redirect visitors, deny access from selected IP addresses, etc. To provide all these facilities on Apache based web servers requires the webmaster to be thoroughly familiar with all the options and must know how to create an htaccess file and how to use htaccess. A webmaster can get help from a developer or be familiar with coding in HTML. Remember any alterations made in this file will have a direct impact on the way the website works and responds to users’ request. Therefore you must know what you are doing and exactly how to do it when making changes in the .htaccess file of a website. Do not attempt to make any changes if you are unfamiliar with the commands that you can encode in .htaccess.

AS SEEN ON:

You May Like Our Most Popular Tools & Apps
Subscribe to our Newsletter & Stay updated