I am creating small data entry software using php with ajax code. But I didn't create .htaccess
file. I have one doubt. must we create .htaccess
file ? why we create .htaccess
file. Please suggest.

- 7,296
- 6
- 30
- 50

- 1
- 4
-
2Just google what is .htaccess, and do a primary research before posting on SO. – Ima Apr 18 '17 at 07:38
-
1https://www.google.com/#q=what+is+.htaccess – Ima Apr 18 '17 at 07:39
-
And google told you nothing? – Cyclonecode Apr 20 '17 at 09:00
2 Answers
A .htaccess file is not mandatory. It has many uses and if there is a specific need, you have to use a .htaccess file. If not, you can ignore it.
For example with .htaccess you can do redirections, you can do authentication with username and password, you can restrict specific directories and many more uses.
In your case, if your needs dont forward you to the use of .htaccess, just dont use one. Although most websites nowadays have at least 1 need that .htaccess covers.

- 1,383
- 2
- 16
- 35
.htaccess is an Apache config file, it works in hierarchical mode, if you load it in a folder, it apply the configuration to all subfolders.
.htaccess is helpful to set timezone, redirect, customize error pages and enable or disable cache.
It is not mandatory however it is recommended its use.

- 309
- 2
- 14
-
Why is it recommended? I can think of many, many situations where you **don't** need an `.htaccess` file? Primarily I use them to handle rewrites or password protect folder etc. – Cyclonecode Apr 20 '17 at 09:02