Fantastic Support

How do I set up a htaccess redirection?

If you want to redirect your domain in a webhosting package, you have to set up a Htaccess redirection.

In this tutorial, we will show you how to do this.

htaccess redirection

Open a text editor and create a file with this content:

RewriteEngine On
RewriteCond %{HTTP_HOST} (www\.)?mustermann.de
RewriteRule (.*) http://www.zieldomain.de/$1 [R=301,L]

Replace mustermann.de and zieldomain.de with your desired data:

mustermann.de = The domain that should be forwarded.

zieldomain.de = The domain to which the forwarding should be made.

Then save this file as ".htaccess".

htaccess redirection always on www

Open a text editor and create a file with this content:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mustermann\.de$
RewriteRule ^(.*)$ http://www.mustermann.de/$1 [R=301,L]

Replace mustermann.de with your domain:

mustermann.de = The domain that should be forwarded.

Then save this file as ".htaccess".

htaccess redirection from http to https

Open a text editor and create a file with the following content:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Save this file as ".htaccess" afterwards.

htaccess reference to a subfolder

For example, if you have a website in a subdirectory, but it is now should appear directly when the domain is called, you can do this as follows.

Open a text editor and create a file with the following content:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?mustermann.de$
RewriteCond %{REQUEST_URI} ¶¶Subfolder/ ¶¶
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subfolder/$1
RewriteCond %{HTTP_HOST} ^(www.)?mustermann.de$
RewriteRule ^(/)?$ subfolder/index.php [L]

Replace mustermann.de, "subfolder" and index.php with your desired data:

mustermann.de = your domain.

"subfolder" = The subdirectory in which the website is located.

index.php = can remain, unless an index.html or index.htm should serve as start page

Then save this file as ".htaccess".

Last step

Open an FTP program such as FileZilla and load the file into the root directory of your domain (default: /htdocs). Please make sure that the forwarding, which may be active for the respective domain via the customer area, is deleted beforehand.

Htaccess forwarding is active immediately.

Was this article helpful?

Thank you very much for your review!

Thank you very much for your review!

You have already rated this item.

Thank you for your time.

Do you require assistance?

Support

Telephone support

Domains worldwide

Europe

  • .at
  • .ch
  • .de
  • .eu
  • .fr
  • .it
  • .nl
  • .uk
  • .es
  • .pl
  • .me
  • .li

Asia

  • .ae
  • .cn
  • .hk
  • .in
  • .io
  • .jp
  • .my
  • .la
  • .sg
  • .tw
  • .ps

Generic

  • .biz
  • .com
  • .info
  • .mobi
  • .net
  • .org
  • .travel
  • .xxx
  • .pro
  • .jobs
  • .name
  • .aero

New domain extensions

  • .online
  • .sale
  • .reise
  • .hotel
  • .xyz
  • .ruhr
  • .restaurant
  • .coupon
  • .video
  • .bayern
  • .berlin
  • .hamburg
  • .koeln
  • .london
  • .reisen
  • .saarland
  • .wien
  • .bio
  • .business
  • .events
  • .haus
  • .immo
  • .immobilien
  • .international
  • .versicherung

Companies that trust us

Other products you might be interested in

Webhosting
Concentrate fully on your project! Performance and security included.
Rankingoach
Optimize your Web site and achieve top rankings.
Website optimization
SSL Certificates
For your site, more safety protect yourself from hacker attacks.
Quickly protect