Skip to main content

How To Use .htaccess Files - Advanced Tips and Tricks - #86


Like what you see, support the channel.

Published: March 11, 2022


Estimated Reading Time
1 minutes
Video Duration
1:15:48 minutes

Watch the directives you need to know tutorial: https://youtu.be/mD3jrHZ3gUw

In my previous .htaccess tutorial, we went over basic .htaccess commands like how to remove extensions and do redirects. This time, we take what we know about .htaccess and add advanced rules.

In this tutorial, we will go over more redirect types, how to block bots and bad user agents, how to prevent URL sniffing, and how to optimize your images, code, and website through a .htaccess file.

If you are a PHP developer, these are advanced .htaccess directives you need to know.

00:00 Intro

02:30 Set the Server TimeZone (TZ)

03:55 Server Signature

05:00 Error Pages

09:22 Redirects Again

13:50 WWW-NonWWW or NonWWW-WWW

17:39 Blacklisting IPs and Domains

24:20 Blocking

38:00 Default Directory Page in SubFolders

41:28 Block Specific Files

44:49 Force Downloads

46:50 Prevent Hotlinking

56:28 Speed: Expires by Type

1:03:25 Speed: Cache-Control

1:06:26 Speed: GZip

1:12:20 Speed: Vary: Accept-Encoding

View the source code: https://github.com/thedevdrawer/advanced-htaccess-rules

Join this channel to get access to perks:

https://www.youtube.com/channel/UCcr8eSk5xCfn3AbYy8WOWzg/join

Become a Patreon to show support and get exclusive access to content: https://www.patreon.com/devdrawer