.htaccess files in Agency Hosting

Updated 4 weeks ago

Agency Hosting uses Nginx web server architecture. The good news is Hostinger’s Agency Hosting now supports .htaccess files. You can create or edit .htaccess directly via File Manager or SSH, and your configurations will take effect on the server. 

Everything you did with .htaccess can also be accomplished through our hPanel. You can manage common configurations through hPanel as an alternative to .htaccess.

Common .htaccess tasks & Agency hosting alternatives

1. URL Redirects

Old way (.htaccess):

Redirect 301 /old-page.html /new-page.html

RewriteRule ^old-category/(.*)$ /new-category/$1 [R=301,L]

Agency hosting way:

Use the Redirects feature in your control panel:

  1. Navigate to your website settings
  2. Go to Domains – Redirects section inside your website dashboard
  3. Select the URL path you want to redirect from and to:

Websites redirects page for creating a domain redirect, with source domain filled in

2. IP Blocking & Access Control

Old way (.htaccess):

Order Deny,Allow

Deny from 192.168.1.100

Allow from all

Agency hosting way:

Use the IP Blacklist feature:

  1. Go to Security section in your website dashboard
  2. Select IP Blackslist
  3. Add IP addresses to block
  4. Save changes

Websites IP blacklist page with IP address input and Add IP address button

3. Force HTTPS

Old way (.htaccess):

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Agency hosting way:

SSLs are installed automatically. But if you want to install a Custom SSL, you can do that by following these steps

  1. Go to Security section in your website dashboard
  2. Select SSL
  3. Click “Manage” and “Install custom SSL”
    SSL page with Install custom SSL menu option highlighted
  4. Follow instructions shown in the modal
    Custom SSL install dialog with certificate and private key fields and Install button