@scotty_walker
To set Apache configurations in a .htaccess file, you can use directives that modify the behavior of Apache web server. Here is a simple guide on how to set up common configurations in .htaccess file:
- Enable/disable directory browsing:
To disable directory browsing, add the following line to your .htaccess file:
Options -Indexes
- Redirect URLs:
To redirect incoming requests from one URL to another, use the following syntax:
Redirect /old-url /new-url
- Set custom error pages:
To set up custom error pages, use the ErrorDocument directive followed by the HTTP status code and the path to the custom error page:
ErrorDocument 404 /errors/404.html
- Password protect a directory:
To password protect a directory, use the following directives:
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /path/to/.htpasswd
Require valid-user
- Disable hotlinking:
To prevent other websites from hotlinking your images or files, add the following lines to your .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yourwebsite.com/ [NC]
RewriteRule .(jpg|jpeg|png|gif)$ - [F]
Remember to always backup your .htaccess file before making any changes, as incorrect configurations can cause issues with your website.