What is an .htaccess file?
An .htaccess (hypertext access) file is a per-directory configuration file used by Apache web servers. It lets you override the main server configuration to control URL rewriting, redirects, access control, caching, compression, security headers, and more, all without touching httpd.conf.
How do redirects work in .htaccess?
Redirects in .htaccess use the mod_rewrite or mod_alias modules. A 301 redirect tells browsers and search engines a URL has permanently moved, passing SEO value to the new URL. A 302 redirect is temporary. The generator outputs the correct RewriteRule or Redirect directive based on your choice.
How do I force HTTPS using .htaccess?
Enable the 'Force HTTPS' option in the generator. It outputs a RewriteCond checking %{HTTPS} off, followed by a 301 RewriteRule that redirects every request to the https:// version of the same URL.
What is hotlink protection?
Hotlink protection prevents other websites from embedding your images (or other files) directly from your server, which wastes your bandwidth. .htaccess can block requests whose HTTP Referer header doesn't match your allowed domains.
What is browser caching in .htaccess?
Browser caching tells visitors' browsers to store static assets (images, CSS, JS, fonts) locally for a defined period. This dramatically speeds up repeat visits and reduces server load. The generator uses mod_expires and Cache-Control headers.
Can incorrect .htaccess rules break my website?
Yes. A syntax error or a missing module can cause a 500 Internal Server Error and take a site offline. Always back up your existing .htaccess before replacing it, and test on a staging environment when possible.
How do I restore my previous .htaccess configuration?
Before uploading the new file, download a copy of your current .htaccess and save it as .htaccess.bak. If anything breaks, rename .htaccess.bak back to .htaccess via FTP, SSH, or your hosting file manager.
Is this .htaccess generator free?
Yes. The generator runs entirely in your browser, requires no signup, and is 100% free to use.