Example of .htaccess file

.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.

Here are some nice and simple example for a htaccess file for any website. From here you con add more options to it.

Forcing https on all traffic

Forcing https on a specific domain

Wants to learn more about htaccess

https://www.whoishostingthis.com/resources/htaccess/

is a good article to read. Check the htacces-guide [here](http://www.htaccess-guide.com/).

----------

Home

Linux

Notes

MicroLog

----------

© DarknessCode