In order to (re)use your domain name at the same time for both your Website (or CMS, or content directory) and your Rebrandly account, you will need to make sure the domain name is connected to your account as an alias domain, and that you are allowed to install plugins on your website.
If you connected the domain name to Rebrandly using the classic DNS method, please delete the domain and re-add specifying that you want it to be an alias. While the instructions to connect the domain are available in this article, the activation part requires some actions from your side.
Actions required on your website
Configuring the aliasing plugin on your domain includes different steps depending on the technology and product you use for the Website/CMS currently installed on the domain name (e.g. WordPress, Wix, Shopify, custom PHP website, single-page application, HTML/JS/CSS website).
- Please note that we strongly advise requesting the help of someone with expertise and permissions to operate on the Website/CMS.
- WARNING: Although we offer several plugins to automate the integration, if you still opt for a solution using a custom script, please make sure that the script is activated only for requests currently leading to your 404 (page not found) page: a mistake in the configuration could lead to redirect all your website's traffic to Rebrandly, resulting in downtime for your services.
- If you have any doubts do not hesitate to ask for help from our support: Rebrandly.support/contact
Right after the alias domain name is associated (connected) to your Rebrandly account, you will be given a special domain name - the "alias" - which has a value similar to the following:
xyzxyzxyz.rebrandly.cc
Note down the alias value: it is strictly necessary to configure your plugin/script and its unique to you and to your domain name.
You can get to know the alias value for any branded domain you connected, in their corresponding detailed page in Rebrandly.
How it works
Make sure you get familiar with the basic idea behind the aliasing feature:
Any traffic you are currently missing on your website will be forwarded to the special alias domain name.
E.g. suppose you receive traffic on https://mydomain.com/donald/duck route but /donald/duck happens to not exist as a content/page on your website, then the request will be transformed into https://xyzxyzxyz.rebrandly.cc/donald/duck by the plugin, and Rebrandly will take care of it. Defining a branded link as mydomain.com/donald/duck will allow you to manage this redirection without touching your website!
You can set the alias value while configuring the plugin/script.
How to install
The following methods are alternatives - you will only have to choose one depending on the product/technology of the service currently installed on your domain name.
The alias domain on Rebrandly will start working only after the configuration is done and saved from your side. The domain alias details and instructions will also appear in the list of your domain names. You will receive an email when Rebrandly was able to verify the setup is correct.
WordPress CMS
In case your website/blog is on a WordPress install or on a managed WordPress service (such as WPEngine), you can install our plugin and configure it with the alias domain name Rebrandly has generated for it.
Please refer to our specific guide for WordPress admins.
Node.js (Express)
To integrate Rebrandly aliasing in your Express web server, make use of the official rebrand-express npm package. Check out the repository for more info:
https://github.com/rebrandly/rebrandly-express
Find below an example integration:
const rebrandlyRouter = require("rebrandly-express");
const options = { "alias": "{{alias}}" };
const fallbackToRebrandly = rebrandlyRouter(options);
// init your app as usual and add your own middlewares
...
// then add Rebrandly right before your latest catchall rule for 404
app.use(fallbackToRebrandly);
app.use('*', your404Handler);
Make sure to replace {{alias}} with your alias value, also remove the {{ and }}
NGINX Web Server
WARNING: we have no ready-to-install plugins yet for NGNIX. The following instructions are meant for users with expertise in routing strategies.
Please make sure to prevent loops from happening (our plugins prevent loops, but you are advised to prevent this manually with NGINX): this script will make your current 404 page invisible. If you still want to show the 404 page for all traffic which is not matching a branded link, you are supposed to:
- define a new, specific, route to reach your 404 HTML page (e.g. /404 or /not-found)
- set this route in the Branded Domain configuration in Rebrandly as "Custom 404 URL" (e.g. https://mydomain/not-found), so that Rebrandly will call back your website at the specific route without entering a loop.
Add the following instructions in the configuration file to forward ONLY your 404 traffic to Rebrandly
server {
...
location / {
# define the error function
error_page 404 = @rebrandly;
}
location @rebrandly {
rewrite ^/(.*)$ https://{{alias}}/$1 redirect;
}
...
}
Make sure to replace {{alias}} with your alias value, and also remove the {{ and }}.
In order to pass the domain verification by Rebrandly you also need to follow these instructions to manually upload a verification file
IIS Web Server
WARNING: we have no ready-to-install plugins yet for IIS web server. The following instructions are meant for users with expertise in routing strategies.
Please make sure to prevent loops from happening (our plugins prevent loops, but you are advised to prevent this manually with IIS): this script will make your current 404 page invisible. If you still want to show the 404 page for all traffic which is not matching a branded link, you are supposed to:
- define a new, specific, route to reach your 404 html page (e.g. /404 or /not-found)
- set this route in the Branded Domain configuration in Rebrandly as "Custom 404 URL" (e.g. https://mydomain/not-found), so that Rebrandly will call back your website at the specific route without entering a loop.
Add the following instructions on the web.config file to forward ONLY your 404 traffic to Rebrandly.
Please note that the configuration will work only on a file-based web page. If you have an application installed on ISS, we recommend you install a plugin in the application itself, instead.
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{{alias}}/{R:1}" />
</rule>
</rules>
</rewrite>
Make sure to replace {{alias}} with your alias value, and also remove the {{ and }}.
In order to pass the domain verification by Rebrandly you also need to follow these instructions to manually upload a verification file
Javascript (client-side)
WARNING: we have no ready-to-include library/script yet for Javascript-based routing. The following instructions are meant for users with expertise in routing strategies.
Please make sure to prevent loops from happening (our plugins prevent loops, but you have to do this manually if you opt for a vanilla javascript integration): this script will change the behavior of your current 404 page. If you still want to show the 404 page for all traffic which is not matching a branded link, you are supposed to:
- define a new, specific, route to reach your 404 HTML page (e.g. /404 or /not-found)
- set this route in the Branded Domain configuration in Rebrandly as "Custom 404 URL" (e.g. https://mydomain/not-found), so that Rebrandly will call back your website at the specific route without entering a loop.
Steps:
- Locate your current 404 page
- Locate the <head> section in the HTML: it is important that the Rebrandly script is loaded as early as possible so that no content is shown before the redirection takes place
- Integrate the following code (copy from <script type="text/javascript"> until </script>) right after the opening tag for <head> as in the example
<html>
<head>
<script type="text/javascript">
window.location = "https://{{alias}}/" + window.location.pathname + window.location.search;
</script>
…
</head>
...
</html>
Make sure to replace {{alias}} with your alias value, also remove the {{ and }}.
In order to pass the domain verification by Rebrandly you also need to follow these instructions to manually upload a verification file.
PHP
WARNING: we have no ready-to-include package yet for PHP-based routing. The following instructions are meant for users with expertise in routing strategies.
Please make sure to prevent loops from happening (our plugins prevent loops, but you are advised to prevent this manually within your PHP application): this script will make your current 404 page invisible. If you still want to show the 404 page for all traffic which is not matching a branded link, you are supposed to:
- define a new, specific, route to reach your 404 HTML page (e.g. /404 or /not-found)
- set this route in the Branded Domain configuration in Rebrandly as "Custom 404 URL" (e.g. https://mydomain/not-found), so that Rebrandly will call back your website at the specific route without entering a loop.
Steps:
- Locate the PHP function currently returning your current 404 page
- Integrate the following code as the first code instruction of the function
<$
Header( "Location : https://{{alias}}{$_SERVER["REQUEST_URI"]}" );
$>
Make sure to replace {{alias}} with your alias value, and also remove the {{ and }}.
In order to pass the domain verification by Rebrandly you also need to follow these instructions to upload the verification file.
.NET core
WARNING: we have no ready-to-include package yet for routing on .NET core servers. The following instructions are meant for users with expertise in routing strategies.
Please make sure to prevent loops from happening (our plugins prevent loops, but you are advised to prevent this manually within your PHP application): this script will make your current 404 page invisible. If you still want to show the 404 page for all traffic which is not matching a branded link, you are supposed to:
- define a new, specific, route to reach your 404 HTML page (e.g. /404 or /not-found)
- set this route in the Branded Domain configuration in Rebrandly as "Custom 404 URL" (e.g. https://mydomain/not-found), so that Rebrandly will call back your website at the specific route without entering a loop.
Steps:
- Locate the Startup.cs file or any other file currently managing your current 404 behavior.
- Integrate the following code
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
...
app.Use(async (context, next) =>
{
await next();
if (context.Response.StatusCode == 404)
{
// redirection rule
context.Response.Redirect($"https://{alias}{context.Request.Path}{context.Request.QueryString}");
}
});
app.Run(async (context) =>...
}
}
Make sure to replace alias with your alias value, do not remove the { and }.
In order to pass the domain verification by Rebrandly you also need to follow these instructions to upload the verification file.
Flask
WARNING: we have no ready-to-include package yet for Flask-based routing. The following instructions are meant for users with expertise in routing strategies.
Please make sure to prevent loops from happening (our plugins prevent loops, but you are advised to prevent this manually within your Flask application): this script will make your current 404 page invisible. If you still want to show the 404 page for all traffic which is not matching a branded link, you are supposed to:
- define a new, specific, route to reach your 404 HTML page (e.g. /404 or /not-found)
- set this route in the Branded Domain configuration in Rebrandly as "Custom 404 URL" (e.g. https://mydomain/not-found), so that Rebrandly will call back your website at the specific route without entering a loop.
Steps:
- Locate the Flask function currently returning your current 404 page
- Integrate the following code
@app.route('/<path:path>')
def catch_all(path):
new_path = 'https://{{alias}}/' + path
return redirect(new_path, 302)
Make sure to replace {{alias}} with your alias value, also remove the {{ and }}.
In order to pass the domain verification by Rebrandly you also need to follow these instructions to upload the verification file.
_____
TIP: If the configuration method you need/prefer is missing please let us know and we will add it.
This article is about:
- Domain alias for branded links
- 404 traffic redirect options for branded domain names
- Use the main domain for branded links
- Use a domain name for the company website and branded links
- Your brand on your links - alias domain name
- Url shortener with the main domain name
See also:
Comments
1 comment
You don't talk about Shopify. How do we install it on Shopify?
Please sign in to leave a comment.