In this article, we will learn how to create a 301/302 redirect like Apache or Nginx in the Jamstack CMS called Draftbox. The idea is the same, but the approach is different. If Nginx uses a .conf configuration file, Apache uses .htaccess to implement permanent or temporary 302 redirects.
Draftbox uses Netlify as its server, DNS (optional) and CDN. With the features and reliability of Netlify, Draftbox is able to display websites with fast uptime and accommodate many visitors; Netlify also offers a free package which is quite a relief for users.
Because using Netlify, this redirect is somewhat impossible considering that Netlify does not have .htaccess configurations like Apache and .conf like Nginx. To solve this, you can use two approaches, the first through Netlify Redirects and the second using Draftbox Redirects.
Some time ago, we tried to contact the Draftbox team and ask if the redirects in Draftbox were limited. Their answer has no limit to the number of redirects that can be added. That means, you can add multiple redirects at once.
In this tutorial, we will use the second approach, namely Draftbox Redirect because it can embed many redirects without limits and is free.
Google recommends websites that are already publishers to create
ads.txt on their website. This is to prevent loss earning AdSense. On the other hand, this is the publisher’s compliance with Google’s rules and policies.
Redirect creation in Draftbox & GitHub repository
To enable Redirect, you can use the menu Advanced Options > Redirects.
After that, Click
+ Add Menu Item to add a redirect. You enter or register on GitHub & create a new repository. The next step is to create
ads.txt in the repository.
After creating ads.txt, the next step is to click the button
Raw and the original path of the file will be visible.
The URL above is just an example, for a live demo, use your GitHub URL.
When done, copy the raw link and paste it in Draftbox Redirect.
In the From, for
/ads.txt. While in part To, use the copied raw github url. For status you can use 301 or 302.
Apply the changes you’ve made
Unlike WordPress, Drupal or similar CMS. In Draftbox, you need to apply changes manually. After making changes, a button will appear Publish Now.
By clicking this button, Draftbox will notify Netlify that there have been changes in Draftbox which must be applied immediately. But not only configuration changes, every article that is made must go through this process immediately after being published in order to appear on the website page.
To test if the redirect works properly, go to the url
https://proapk.in/ads.txt. When it leads to raw GitHub, it means that the redirect we have created worked well. But conversely, if that appears on the 404 page; that means the redirect we created failed.
The URL above is just an example, for a live demo, use your website URL.
Apart from creating a redirect for ads.txt, you can use this method to create a robots.txt, displaying ads from third parties such as Infolinks. Show push notification from OneSignal or SendPulse.
ProApk on Google News – https://news.google.com/publications/CAAqBwgKMP_S9AowhYDbAg
ProApk on Telegram – https://t.me/proapk_in
ProApk on Twitter – https://twitter.com/xdapirates
ProApk on Facebook – https://facebook.com/www.proapk.in