Welcome to this lesson on the .htaccess Maker.

Admin Tools can generate a customised .htaccess file that adds an extra layer of security and performance to your website.

Before you use it, your Joomla site should already be using URL rewriting. If you've previously enabled Use URL Rewriting in Joomla's Global Configuration and your site is working correctly, then you're ready to continue.

To open the tool, go to Security and select .htaccess Maker.

Before making any changes, there's one important precaution.

A mistake in your .htaccess file can prevent your entire website from loading. That's rare, but if it happens you'll need access to your site using FTP or your hosting provider's file manager so you can restore the previous file.

If, when setting up Joomla's own .htaccess file, you had to make changes for your hosting provider, you'll probably need to make the same changes here.

You'll find those options towards the bottom of the page.

For example, some hosting providers require Follow SymLinks to be enabled, or the base directory to be changed if Joomla is installed in a subdirectory.

If Joomla's standard .htaccess worked without any changes, you can usually leave these settings at their defaults.

The rest of the page contains a large number of security options.

Each one is fully explained in the Admin Tools documentation, and for most websites the default settings are the best choice.

Unless you understand exactly what a setting does, it's usually best to leave it unchanged.

As well as protecting your website, .htaccess Maker can also protect access to files on your server.

Some Joomla extensions legitimately need direct access to specific files, so Admin Tools already includes exceptions for extensions such as Akeeba Backup, Admin Tools and Joomla Update.

If you use other extensions that require similar access, you may need to add additional exceptions.

There's also a section for custom .htaccess rules.

If you've never created custom Apache rules before, you can safely ignore this section.

However, if your hosting provider has previously asked you to add custom directives, or you've already added your own rules to your existing .htaccess file, this is where you should copy them.

For example, some hosting providers use .htaccess to select the version of PHP that your site runs. If that's the case, be sure to copy those directives here before creating your new file.

The final section contains optimisation and utility options.

These provide a few additional tweaks, and in most cases the default settings are appropriate.

Once you're happy with the configuration, click Save and Create .htaccess.

Admin Tools writes the new .htaccess file to your server and keeps a backup of the previous version.

At this point, don't assume everything is working correctly.

Take a few minutes to test your website thoroughly.

Browse several pages, log in to the administrator, submit a form, and make sure any extensions you use are behaving normally.

If you discover that part of your site no longer works, return to .htaccess Maker and adjust the settings or add the necessary exceptions before creating the file again.

If your website displays a blank page or a 500 Internal Server Error, don't panic.

Using FTP or your hosting provider's file manager, locate the .htaccess file in the root of your website and rename it to something like .htaccess.disabled.

Once the file has been renamed, Apache will ignore it and your website should become accessible again.

You can then return to Admin Tools, review your configuration, and generate a new .htaccess file until everything works as expected.