Setting Up A 301 .Htaccess Redirect

  • Knowledge Base
  • Responsive Website Builder
  • Setting Up A 301 .Htaccess Redirect
  • Duda Support > Responsive Website Builder > Going Live


Some domain hosts do not allow you to create a 301 redirect by default. This means that their default configuration does not support Duda sites. It is possible, however, to get around this by setting up a 301 redirect in your host's .htaccess file. This will allow you to keep using that host, but you will need to keep your existing web hosting account for it to work.

Getting to your .htaccess file

Each domain host will have a different way of accessing your .htaccess file (though it's important to note that domain hosts or registrars who do not offer website hosting will not support this redirection method), but in general your .htaccessshould be in the base (www or public_html) folder of your website. It's often hidden, so you may have to search for it or otherwise contact your hosting provider to help locate it.

Modifying your .htaccess file

Before modifying your .htaccess file, we recommend making a backup; changing a .htaccess file can permanently take your site offline, so having a backup is very useful in case something goes wrong. Once you've made a backup, replace the contents of your .htaccess file with the following line:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Be sure to replace the !$ on line 3 with the base URL of your domain ( !$, for example) and the$1 with your www domain ($1 , for example).

Some web hosts may also include specific directions for modifying your .htaccessfile; these are very important to pay attention to, as they can affect the way your .htaccess is read and cause this code not to work (or to work in an unexpected way!).

Once you've changed your .htaccess file, simply save it and your redirect should be complete. You may need to clear your phone's cache (or, depending on server configuration, your webhosting server's cache) to see the results.


Please Log in as a Pro

Priority Phone Support is available exclusively to Pros. Log in to your Pro account now to see our international support numbers.

Log In
Not a Pro? Purchase a Pro plan!