Avoid 301 redirect in cdn.domain.mx
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, redirects, 301-redirect, cdn, .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :I have a domain with a .htaccess redirection problem. The active CDN the URL should be: cdn.domain.mx/images/test.png but redirects:
cdn.domain.mx/images/something.png -> www.domain.mx/images/something.png
This causes my web resources not to be served from the CDN. Here is the code in the .htaccess:
RewriteEngine on
RewriteCond %HTTPS on
RewriteRule (.*) http://%HTTP_HOST%REQUEST_URI [R=301,L]
RewriteCond %HTTP_HOST ^domain.com$ [OR,NC]
RewriteCond %HTTP_HOST ^www.domain.com$ [OR,NC]
RewriteCond %HTTP_HOST ^domain.example.com$ [OR,NC]
RewriteCond %HTTP_HOST ^www.domain.example.com$ [OR,NC]
RewriteCond %HTTP_HOST ^domain.mx$ [NC]
RewriteRule ^(.*)$ http://www.domain.mx/$1 [R=301,L]
I have also configured the CNAME on my domain:
cdn.domain.mx. CNAME domain.company.netdna-cdn.com
Details:
A resource site is:
www.depilacionconlaser.mx/images/contenidos/inicio/productos-principales/depilacion-laserhome.jpg
The URL of the resource with CDN is:
cdn.depilacionconlaser.mx/images/contenidos/inicio/productos-principales/depilacion-laserhome.jpg
If I enter the URL of the resource with CDN in my browser, I'm redirected to www. Redirection not indicated in the HTACCESS.
CDN servers are configured to serve the resource if they already have a copy. If they don't have a copy, they need to fetch it from your website. To do so, they need to know what the address of your server is. You would have told them this information during the setup process for the CDN.
It seems likely to me that the CDN is set up to fetch content from domain.mx, www.domain.com or one of the other domains that you are redirecting. In that case, the CDN would serve redirects for those resources.
The solution would be to reconfigure your CDN to fetch content from www.domain.mx when it doesn't have a copy of the content. Log into your CDN account to make this setting change.
Comments
Post a Comment