Advanced Features

How to Setup Custom Domains in URL Shortify

To establish a custom domain in URL Shortify, ensure your secondary domain redirects to your main domain where URL Shortify is installed.

Apache Redirect

If your secondary domain isn't pointing to your main domain, you can configure this using a .htaccess file on Apache servers.

Add these lines to your .htaccess file at the root of your secondary domain:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

Nginx Redirect

For Nginx servers, configuration happens in a .conf file, typically located at /etc/nginx/sites-available/directory_name.conf. The document root (where your site files reside) might be in /html for single sites or /domain.com for multiple sites. You can copy or modify the default file in /etc/nginx/sites-available/ or create a new configuration file.

Redirect your old URL to a new URL using this format:

server {
  # Permanent redirect to new URL
  server_name olddomain.com;
  rewrite ^/(.*)$ http://newdomain.com/$1 permanent;
}

When accessing your old domain, it will redirect to your new domain with query parameters preserved.

After completing the redirect setup, add your old domain (secondary domain) to URL Shortify via URL Shortify > Domains.

Was this page helpful?

Previous
Broken Link Checker