What is the .htaccess file and what do I use it for?

karlkoeller

New member
Registered
Joined
Jul 29, 2016
Messages
4
Points
0
I have some questions with .htaccess file, i used it more times on my hosting but I don't know what is the main purpose of using .htaccess file? What can you do with a .htaccess file and errors can be caused by the .htaccess file? does anyone explain me?

Thanks
Karl
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
Hi Karlkoeller,

A .htaccess file allows each user on the server to have their own custom web server configuration.

you can do you many things with your .htaccess file including

Password protecting directories
Rewriting URL's
Setting default pages
Customize the Error pages for your site
Prevent directory listing
Enable server-side includes
 

fwh

Administrator
Staff Member
Joined
Dec 8, 2012
Messages
773
Points
63
fwh
Other than that, I would add to your list

  • Custom Error documents
  • Redirects
  • Password protection
  • Deny visitors by IP address
  • Deny visitors by referrer
  • Hot link prevention techniques
  • Blocking offline browsers and 'bad bots'
  • DirectoryIndex uses
  • Adding MIME types
  • Enable SSI with .htaccess
  • Enable CGI outside of the cgi-bin
  • Disable directory listings
  • Setting server timezone
  • Changing server signature
  • Preventing access to your PHP includes files
  • Prevent access to php.ini
  • Forcing scripts to display as source code
  • Ensuring media files are downloaded instead of played
  • Setting up Associations for Encoded Files
  • Preventing requests with invalid characters

The most used functions I used in .htaccess file is redirect urls and adding rewrite rules, its really helpful for my websites.

Hope that helps!
 

VirtuBox

Well-known member
Registered
Joined
May 3, 2016
Messages
1,622
Points
83
.htaccess is an Apache configuration file. When you Apache open a folder to display your website to your visitor, it will read the .htaccess to apply the rules.
You can use .htaccess file to add a rule for apache.
 

nairprasad7

New member
Registered
Joined
Aug 2, 2016
Messages
14
Points
3
.htaccess is short for Hypertext Access, and is a configuration file used by Apache-based web servers that controls the directory that it "lives" in--as well as all the subdirectories underneath that directory. Also helps to create Custom Error Pages for Better SEO.
 
Newer Threads
Replies
6
Views
4,356
Replies
7
Views
5,090
Replies
5
Views
3,095
Latest Threads
Replies
1
Views
23
Replies
0
Views
175
Replies
1
Views
37
Replies
2
Views
81

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top