Smart Deals - promotions, discount codes and sales

Htaccess Toolsti Generator

Fast, accurate and free online htaccess toolsti generator tool running directly in your browser.

Secure (SSL)
Client-Side Processing
100% Free
Instructions
  • 1
    Enter data
    Enter content, paste text or load a file from disk.
  • 2
    Click the button
    The tool will immediately process your data in the browser.
  • 3
    Get the result
    Copy the finished text or save the file to your device.
function runTool() {
  return "Result ready in 0.1s";
}

Rate this tool:

Related tools

Other tools you may find useful

.htaccess generator – Apache mod_rewrite and redirections

The .htaccess (Hypertext Access) file is a directory-level Apache configuration – without access to the main httpd.conf. The generator creates ready-made rules for the most common applications: redirections, URL rewriting, access protection and security headers.

htaccess generator .htaccess rules Apache mod_rewrite .htaccess redirects

.htaccess file basics

Location: in the webroot directory (public_html) or subdirectories. Scope: works for the given directory and subdirectories. AllowOverride: must be enabled in httpd.conf (AllowOverride All). Execution: Apache parses on every request (note: performance!). Format: Apache directives, comments with #. The most common modules: mod_rewrite, mod_auth, mod_headers.

301 and 302 redirects

301 Permanent: SEO-friendly, change URL permanently. Redirect 301 /old-page.html /new-page. RewriteRule ^old-page$ /new-page [R=301,L]. 302 Temporary: no SEO impact, temporary. Redirect 302 /promo /landing. HTTPS redirect: RewriteCond %{HTTPS} off → RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]. www → non-www: RewriteCond %{HTTP_HOST} ^www\.

URL Rewriting – friendly addresses

mod_rewrite: converts readable URLs into query strings. RewriteEngine On (required). RewriteRule ^article/([0-9]+)$ index.php?id=$1 [L]. CMS: WordPress uses RewriteRule ^index\.php$ - [L] + RewriteRule . /index.php [L]. Laravel/Symfony: RewriteRule ^ index.php [L]. Flags: [L]=last, [R]=redirect, [QSA]=query string append, [NC]=case insensitive.

Security via .htaccess

Password protection (Basic Auth): AuthType Basic + AuthName + AuthUserFile /path/.htpasswd + Require valid-user. IP blocking: Deny from 192.168.1.1. File protection:Deny from all. Turn off directory listing: Options -Indexes. Security headers: Header always set X-Frame-Options DENY. HTTP method limit: PUT DELETE limit.

FAQ

How to perform HTTPS redirection via .htaccess?

RewriteEngine On. RewriteCond %{HTTPS} off. RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]. For servers behind a proxy/load balancer: RewriteCond %{HTTP:X-Forwarded-Proto} !https. Check in browser via DevTools (Network): code 301 and Location header. After implementing HTTPS: clear browser cache (Ctrl+Shift+Del).

How to password protect a directory?

htpasswd -c /home/user/.htpasswd username (create file). htpasswd /home/user/.htpasswd username2 (add). .htaccess: AuthType Basic, AuthName "Restricted Area", AuthUserFile /bezwzgledna/path/.htpasswd, Require valid-user. NOTE: .htpasswd outside webroot (so it is not publicly available). HTTPS + Basic Auth: encrypts credentials.

How to fix error 500 after editing .htaccess?

Syntax error in .htaccess = HTTP 500. Check: Apache error_log (often /var/log/apache2/error.log). Temporarily: rename it to .htaccess.bak → check if the 500 disappears. Debug line by line: comment # new rule. Online validator: htaccess.madewithlove.com. Common errors: missing RewriteEngine On, wrong path to AuthUserFile.

What is the difference between .htaccess and nginx.conf?

Apache: .htaccess (per-directory), httpd.conf (global). Nginx: no .htaccess, everything in nginx.conf/vhost. Performance: .htaccess slower (parsing each request). Nginx: faster because the configuration is loaded once. Apache→Nginx migration: rules need to be rewritten. Nginx rewrite: location ~ ^/old/(.*)$ { return 301 /new/$1; }.

How to se
Install Webp.pl Have the tools in your own pocket!