What is htaccess in php | Lessoncup Programming Blog

Monday, 28 March 2016

What is htaccess in php

What is Htaccess? some programmers are wondering about .htaccess file and  what is the usage of this and how it will work for our websites, the meaning of .htaccess is Hypertext Access and it is a configuration file use in web servers and Apache Web Server Software control the .htaccess file, The Htaccess file is a plain text and we can write the rules to our entire website to folder structure in our website hosted server, we can do lot of things using .htaccess file


the Htaccess file don't have any extension like .html or .php the only type is .htaccess without any file name and it is tell to server what type of file it is, once you upload the .htaccess file in your server it will take effect to entire directory it is placed in and effect to all sub directory's and files with in the main directory

Some Hosting providers will not give access to edit or upload our custom .htaccess file if you got any trouble after upload the file if you not seen any result of  htaccess file it means your server provider not allowing your .htaccess file, you should request your hosting provider to give the access to your file, see the bellow few rules we can give to our website

  • Domain and Sub Domain Redirection, 
  • Password Protections, 
  • Friendly Url's, 
  • Custom Error Pages, 
  • Hiding file extensions 
  • Stop Directory Listing
  • Use Different file as the Index file
and many more we can do with .htaccess file

Creating .htaccess file

to create a .htaccess file open any text editor applications even notepad also and save the file as .htaccess name, and remember the htaccess file will not work until you must enable the mode_rewrite extension in php.ini file in Apache web server configurations

if you not found the mode_rewrite extension in php.ini file start your wamp server click on wamp server go to Apache and Apache Modules and click on rewrite_module to enable,  hope this will give the basic idea of htaccess.

No comments :

Post a Comment

Mohammad Khasim
Blogger | Web Developer
Hyderabad - INDIA
lessoncup@gmail.com

PHP | My SQL | JQUERY
Web Development Tools | CMS | Frameworks | SEO

Get my Latest Lessons