Free .htaccess and robots.txt Generator

Build the rules your Apache server needs for HTTPS, redirects, caching, compression and security headers, along with a matching robots.txt file.

Server racks in a data centre with blue status lights

Generate your files

Your settings

.htaccess rules

Choose a year only if your file names change when you edit them.

One per line: the old path, a space, then the new address.

robots.txt

One per line. Leave empty to allow everything.

Putting it live

Uploading the files safely

Before uploading, download a copy of any .htaccess file already on the server. If anything goes wrong, putting the old file back restores the site in seconds.

The download is called htaccess.txt because many computers hide files that start with a dot. Rename it to .htaccess once it is on the server. The robots.txt file keeps its name and goes in the same top folder.

After uploading, open the site in a private browser window and check a few pages, including one old address you redirected.

Web developer uploading files to a server from a laptop

Speed and security

Small file, big difference

Compression shrinks text files on their way to the browser, and caching lets returning visitors reuse files they already have. Both help pages load faster and can lift a Google PageSpeed score.

Sending everyone to one address, with HTTPS and either www or no www, stops search engines seeing the same page under several addresses. Security headers add a further layer of protection for very little effort.

Laptop showing a fast-loading website on a bright desk

Questions

.htaccess and robots.txt questions

What is an .htaccess file?

It is a settings file for Apache web servers. Placed in a website folder, it can redirect addresses, force HTTPS, switch on compression and caching, and add security headers without changing the main server setup.

How do I add the file to my website?

Download it, rename htaccess.txt to .htaccess with the dot at the front, and upload it to the top folder of your website by FTP or your hosting file manager. If a file is already there, merge the new lines into it rather than replacing it.

Will this work on every web host?

It works on Apache and LiteSpeed servers, which most shared hosting uses. Nginx servers ignore .htaccess files and need the same rules written into the server settings instead.

What if my site stops working after uploading?

A server error after uploading usually means the host does not allow one of the settings. Remove the new file, or the lines you added, and the site will come straight back. Then add the sections back one at a time to find the one causing trouble.

Does blocking AI crawlers in robots.txt affect my Google rankings?

No. The Google-Extended entry only controls whether content is used to train Google AI models. Normal Google Search crawling is handled by Googlebot, which the generated rules leave alone.

Does robots.txt keep a page out of search results?

Not reliably. It asks crawlers not to visit a page, but a blocked page can still be listed if other sites link to it. To keep a page out of results, let it be crawled and add a noindex meta tag instead.