View Categories

How can I set up the plugin to serve images from a custom subdomain?

Important: 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 Image Optimizer (SPIO) or ShortPixel Adaptive Images (SPAI), instead of spcdn.shortpixel.ai for SPIO or cdn.shortpixel.ai for SPAI, follow these steps:

  1. Log in to your ShortPixel account and from the dashboard, click Associate Domains.
  2. Click on the Domain Settings icon on the right side of your associated domain to reveal the available options.
  3. Click on the Custom CDN Domain button.
  4. Think of a suitable subdomain name for the delivery of your images, such as cdn, img, images, media, and so on. For example, if your website is example.com and you choose img subdomain, your images will be served from img.example.com.
  5. Enter your preferred subdomain name in the “Enter your subdomain” text box.
  6. If you are using your own CDN and do not want to use ShortPixel’s CDN, check the box “I use my own CDN”.
  7. Click on the red Setup Custom Domain button.
  8. Enter your preferred subdomain name and then click the red Setup Custom Domain button.
  9. Navigate to your domain’s DNS records, and add the CNAME you chose (e.g. img.example.com ) pointing to cdn.shortpixel.ai. If you’re unsure how, please contact your hosting provider for assistance.
  10. Once the CNAME record has finished propagating (which may take up to 48 hours), 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.
  11. Optionally, for increased security, you may check the box “Accept requests only from specific domains” and enter a comma-separated list of domains. For example, if only example.com and wonderfulshop.com should serve images from img.example.com, set it up as shown in the following screenshot:
  12. If you are using SPAI, navigate to your WordPress dashboard and go to Settings > ShortPixel AI > Behavior > API URL. There, change the default URL to https://img.example.com/spai where img.example.com is the subdomain that you’ve set up above.
  13. If you are using SPIO, navigate to your WordPress dashboard and go to Settings > ShortPixel > WebP/AVIF & CDN and enable the “Deliver the next generation images using the ShortPixel CDN” option. There, change the default URL to https://img.example.com/spio where img.example.com is the subdomain that you’ve set up above.
Please make sure you flush your website’s cache (whichever is applicable – caching plugin, server cache, CDN cache, and browser cache).