How can I set up SPAI to serve images from a custom subdomain?
Note: If you are on a free plan or have purchased one-time credit packages, you will not be able to add a custom subdomain. Custom subdomains are exclusively available for users who have subscribed to an unlimited or monthly/yearly plan.
If you want to use your own custom (sub)domain when using ShortPixel Adaptive Images, instead of
cdn.shortpixel.ai , follow these steps:
- Log in to your ShortPixel account and from the dashboard, click Associate Domains.
- Click 'Set Custom Domain' on the right side of your associated domain.
- Think of a suitable subdomain name for the delivery of your images, such as
media, and so on. For example, if your website is
example.comand you choose
cdnsubdomain, your images will be served from
Enter your preferred subdomain name and then click the red 'Setup Custom Domain' button.
- Navigate to your domain's DNS records, and add the CNAME indicated (eg.
cdn.example.com) pointing to
cdn.shortpixel.ai. If you're unsure how, please contact your hosting provider for assistance.
Once the CNAME record has finished propagating, you can return to your ShortPixel dashboard where you should find the subdomain added to your list of associated domains. If it doesn't appear, you may try refreshing the page.
Navigate to your WordPress admin dashboard > Settings > ShortPixel AI > Behavior > API URL, and change the default URL to
cdn.example.comis the subdomain that you've set up above.
- Refer to this article and follow the instructions provided under the 'Testing ShortPixel Adaptive Images' section to confirm whether your images are being served from your custom subdomain.
Important: If the images are not served from your custom subdomain after setting everything up, please make sure you flush your website's cache (whichever is applicable - caching plugin, server cache, CDN cache, and browser cache).