SeitenreportSEO & website analysis since 2007

Free · without registration

Create .htaccess file for Apache

Create appropriate Apache rules for your domain. Select the desired host variant, activate HTTPS and, if necessary, add caching, compression and your own error page.

What rules do you need?

Forwarding and extradition

For Apache 2.4 in the main site directory. Existing CMS rules remain separate. HTTPS behind a proxy or CDN must fit the hosting configuration.

Bringing HTTPS and www together in a redirect

A website can be reached via several addresses: with and without www as well as via HTTP and HTTPS. The generator sets a fixed target and gets path and query string. This is how it will be. http://www.beispiel.de/ratgeber?seite=2 directly to https://beispiel.de/ratgeber?seite=2 Forwarded if you choose HTTPS without www.

During installation, 302 is preset. Test the variants with the HTTPS Checker and only then switch to the permanent 301 redirect. The certificate must also be valid for the forwarding HTTPS host.

into an existing one. Install htaccess

  1. Download the existing file and keep it as a backup.
  2. Check whether the same functions are already done by the hoster, CDN or CMS.
  3. Complete the required blocks before existing CMS rewrite rules. Do not overwrite automatically managed WordPress blocks.
  4. Test homepage, subpage, query string and a non-existent URL.
  5. For an error message or loop, restore the backed up file and check the hosting configuration.

Choose cache, GZIP and error side meaningfully

The cache option only affects selected static file types. It does not set a new cache rule for HTML, shopping carts or personal account pages. When making changes to CSS and JavaScript, you should use versioned file names or cache parameters. Compression sets the Apache module mod_deflate ahead; already compressed images are not recompressed.

Your own 404 file must actually exist. Your error status must not be turned into 200 by the application. Then check it with them after they have been installed. Soft 404 Checker.

When other rules are needed

Nginx does not process any . htaccess files. With TLS termination on a reverse proxy, Apache may only see HTTP; an inappropriate HTTPS rule then causes a loop. In this case, let the hoster rank the trusted proxy signals. For individual old URL paths, use the Redirect Regex Tester. The Apache documentation for forwardings explain the underlying directives.

Frequent questions

Will my server configuration be changed automatically?

No. You will receive text and a download file. Installation and testing will then take place on your hosting.

Why is 302 preset?

Temporary forwarding is suitable for the first test. Permanent redirects can be stored by browsers and search engines for a long time. After a successful test, you can select 301.

Does it work with WordPress?

In principle, yes to Apache, if . htaccess and the required modules are allowed. Complete the rules outside of automatically managed WordPress blocks and avoid duplicate redirects.

Does this replace a full server configuration?

No. Permissions, TLS settings, proxy trust and individual application rules remain tasks of hosting configuration.