Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is .htaccess file?

I am a beginner to Zend framework and I want to know more about the .htaccess file and its uses. Can somebody help me?

I found an example like this:

.htacess file

AuthName "Member's Area Name"   AuthUserFile /path/to/password/file/.htpasswd   AuthType Basic   require valid-user   ErrorDocument 401 /error_pages/401.html   AddHandler server-parsed .html   
like image 766
Deepu Avatar asked Nov 01 '12 04:11

Deepu


People also ask

Do I need an htaccess file?

htaccess is not required for having a general website. That file simply allows you to make changes in the way your website behaves for example banning people from accessing your site or redirecting an old dead link to a new page. Some software like Wordpress requires settings in the . htaccess file (or httpd.

Where is the .htaccess file?

htaccess file is located in the root directory of your WordPress site. Depending on your hosting provider, the root directory may be a folder labelled public_html, www, htdocs, or httpdocs. You can locate it by using File Manager in your hosting account's cpanel.

What type of file is htaccess?

An HTACCESS file is a configuration file used by an Apache web server that provides instructions for different directories of a website. "Htaccess" is short for HTTP access, which is the protocol used to transmit webpages. A website's .


2 Answers

It's not part of PHP; it's part of Apache.

http://httpd.apache.org/docs/2.2/howto/htaccess.html

.htaccess files provide a way to make configuration changes on a per-directory basis.

Essentially, it allows you to take directives that would normally be put in Apache's main configuration files, and put them in a directory-specific configuration file instead. They're mostly used in cases where you don't have access to the main configuration files (e.g. a shared host).

like image 108
Amber Avatar answered Oct 10 '22 05:10

Amber


.htaccess is a configuration file for use on web servers running the Apache Web Server software.

When a .htaccess file is placed in a directory which is in turn 'loaded via the Apache Web Server', then the .htaccess file is detected and executed by the Apache Web Server software.

These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer.

These facilities include basic redirect functionality, for instance if a 404 file not found error occurs, or for more advanced functions such as content password protection or image hot link prevention.

Whenever any request is sent to the server it always passes through .htaccess file. There are some rules are defined to instruct the working.

like image 41
Amit Garg Avatar answered Oct 10 '22 06:10

Amit Garg