How to setup custom domains in URL Shortify
To set up a custom domain in URL Shortify, first, you need to make sure your secondary domain is points to your main domain on which URL Shoritfy is installed.
Apache Redirect
If your secondary domain is not pointing to your main domain, you can do it via .htaccess
file if your web server uses Apache.
You can add the following lines to your .htaccess file located at the root of your secondary domain.
Nginx Redirect
When it comes to Nginx, that is handled within a .conf file, typically found in the document root directory of your site(s), /etc/nginx/sites-available/directory_name.conf. The document root directory is where your site’s files live and it can sometimes be in the /html if you have one site on the server. Or if your server has multiple sites it can be at /domain.com. Either way that will be your .conf file name. In the /etc/nginx/sites-available/ directory you’ll find the default file that you can copy or use to append your redirects. Or you can create a new file name html.conf or domain.com.conf.
This is how you can redirect your old URL to new URL
server {
# Permanent redirect to new URL
server_name olddomain.com;
rewrite ^/(.*)$ http://newdomain.com/$1 permanent;
}
Now, when you access your oldomain.com
, it will redirect to newdomain.com
along with the query parameter.
After doing this, please add your old domain (secondary domain) into URL Shortify.
You can add your custom domain from URL Shortify > Domains.
Last updated