Apache .htaccess generator

Generate Apache .htaccess rules for canonical URLs, WordPress or Laravel routing, redirects, caching, compression and security in your browser.

  • Development
  • 100% free & unlimited
  • Runs in your browser
Apache .htaccess generator
Canonical www hostname
Application rewrite
Routes missing files and folders through the selected application entry point.
Slash style

What is the apache .htaccess generator?

Build an Apache .htaccess file from grouped settings for canonical URLs, WordPress or Laravel front-controller routing, 301/302 redirects, Gzip compression, cache lifetimes, security headers, IP access rules and custom error pages.

The generated configuration updates in your browser as you edit the options. Copy or download the file and review it on a staging site before deployment. This generator does not send your settings to a Mota SEO processing endpoint.

How to use the apache .htaccess generator

  1. 1Use the tabs to configure URL rules, redirects, performance, security and custom errors.
  2. 2Add redirect, blocked IP and error-page rules one per line; review the generated Apache directives.
  3. 3Copy or download the generated .htaccess file and review it before use.

Features

Canonical URLs and routing

Force HTTPS, normalize www and generate WordPress or Laravel front-controller rules.

Redirects

Generate permanent 301 or temporary 302 redirects.

Performance

Configure Gzip compression and cache lifetimes for common static assets.

Security

Add security headers, HSTS, deny directory listing, protect sensitive files and block IP/CIDR ranges.

Custom error pages

Map 4xx and 5xx status codes to local pages or HTTP(S) URLs.

Browser processing

The configuration is assembled locally and is not posted to Mota SEO.

Frequently asked questions

Where do I put the generated file?

Save it as .htaccess in the directory it should control, usually the site root. Apache must have AllowOverride enabled for these rules to apply.

How do I add a temporary redirect?

Put the source and target on one line and add 302 at the end. Without it, the generator uses a permanent 301 redirect.

When should I enable HSTS?

Only after HTTPS is working on every relevant hostname and path. Browsers remember HSTS and may keep forcing HTTPS after you change this setting.

Will these rules work on Nginx?

No. .htaccess is specific to Apache. Nginx uses server-block configuration and does not read .htaccess files.

Does this page upload my settings?

No. It generates the file in your browser and does not send the configuration to a Mota SEO processing endpoint.