.htaccess Generator

SEO redirects

Speed

Security

WordPress

Your .htaccess file

Back up first. One mistake in .htaccess can take your whole site down with a “500 Internal Server Error”. Save a copy of your current file before you replace it, and test your site right after.

The download is named htaccess.txt. Upload it to your site’s root folder (public_html) and rename it to .htaccess. Works on Apache and LiteSpeed servers, not Nginx.

How to use the .htaccess Generator

  1. Pick a quick start (WordPress or static site), then enter your domain.
  2. Turn on the options you need: HTTPS, www, redirects, speed and security.
  3. Copy the code or download the file.
  4. In cPanel File Manager (or FTP), open public_html, show hidden files, back up your current .htaccess, then replace it and test your site.

What is a .htaccess file?

.htaccess is a settings file for Apache and LiteSpeed web servers. With a few lines you can force HTTPS, pick www or non-www, set up 301 redirects, speed up your site with compression and caching, and block bad bots. For SEO, the most important job is making sure every page has one version: https, with or without www, and with or without a trailing slash.

If your site breaks

  • A “500 Internal Server Error” means a rule your server doesn’t support. Put back your old file, then turn options off one by one to find the problem.
  • A “too many redirects” error usually means your host or Cloudflare already forces HTTPS. Turn off “Force HTTPS” here.
  • On WordPress, keep the “# BEGIN WordPress” block at the end, and don’t use “Remove .html” or “Trailing slash” rules. Set permalinks in WordPress instead.

Made by Maroof Ahmed. More free tools: Redirect Generator, Robots.txt Generator, Canonical & Noindex Checker and XML Sitemap Generator. Need help with your server setup? Chat on WhatsApp.

Want an expert to do this for you?

I’m Maroof Ahmed, a freelance SEO consultant with 300+ projects for businesses in the USA, UK and Australia. Website migration SEO service →