Home » Technology » htaccess


  • What is htaccess? Htaccess Forwarding (Routing) and htaccess Rewriterule
  • Htaccess is a kind of setup file that can be created on the server itself or can be created by the user and helps to give some useful commands to your web site. The htaccess file is located on Linux operating system servers and helps to add extras to your site easily thanks to the commands used. In short, .htaccess (Hypertext Access) is the file that enables setting changes on the web space used by most network servers, especially Apache.


  • How to Create an htaccess File
  • If you do not see a .htaccess file when you are logged in to the main directory via FTP, you can create an empty file using any text editor, then empty this file. You can assign it to the main index by naming it as htaccess.


  • Why do we use the htaccess file?
  • If we do not want to make some significant changes to our website (eg to prevent an IP from entering our site) we need to reach the configuration files of the server, not the hosting, and make changes here. But as soon as you are a hosting user, you will not be able to access the configuration files of the server. At this stage, you can use the htaccess file to implement important commands for your own hosting space just as the server has reached its actual configuration files.






  • It is possible to easily accomplish the task of setting up many top level servers using htaccess file. These are the main and most frequently used examples;
  • Routing a website to a different adrese
  • Define restricted access to desired folders
  • List folders
  • Perform compression
  • Hide files
  • Set custom 404 not found page
  • Hotlinking Protection
  • Block unwanted bots
  • Especially for websites that use CMS systems (such as WordPress), the “htaccess” file is indispensable and a must-have setting file.


  • Htaccess Forward
  • When you move your website to a different domain, you can use the htaccess file to redirect users who login to this site without losing your new home page.


  • Htaccess Rewriterule

Options + FollowSymlinks

RewriteEngine on

ReWriteCond% {HTTP_HOST} ^ (www.)? Oldlink.com $ [NC]

ReWriteRule ^ (. *) $ Http://www.newlink.com/$1 [R = 301, L]

  • If you place this code in your htaccess file by editing the old address and new address part from the codes in the upper part, forwarding will be performed.
Author: wik Date: 9:45 pm

Wik's Random Content