.htaccess Instructions

Redirecting with the .htaccess File

Kenneth Nyman avatar
Written by Kenneth Nyman
Updated over a week ago

.htaccess is a configuration file that allows Apache server to be configured to behave in a specific way. It can be used to overwrite the rules of Apache’s main configuration files.

Location, Creation, and Editing of .htaccess File

The .htaccess file can be found in the root directory of the site, usually in the httpdocs folder. You can find it from your site’s own Plesk control panel as follows:

  1. Choose File Management

  2. If necessary, create a new .htaccess file under the httpdocs folder by selecting New -> Create File. If one already exists, proceed directly to step 3.

    Write the file name as .htaccess and select OK.

  3. Click on the .htaccess file, and it will open in the code editor.

  4. Write the desired lines into the editor and press OK. Instructions for the operation of the redirect lines can be found below.

Redirecting a Domain with .htaccess (301)

The .htaccess file can be used to redirect all traffic of a domain or, if necessary, also a single page to another address.

All redirect lines start with the words Redirect 301, followed by the address from which to redirect (if it involves the whole domain, write just a slash, /). This is followed by the address to which it is redirected.

Full Domain Redirect

Redirect 301 / http://www.exampleaddress.fi/

Single Page Redirect

Redirect 301 /oldpage.html http://www.exampleaddress.fi/newpage.html

More information (in English) can be found at: https://www.rapidtables.com/web/dev/htaccess-redirect.html

Did this answer your question?