Since I want to use the CDN correctly, I need to rewrite the URL without manually changing the path of each image.
I tried a .htaccess code and it is recommended for similar problems
RewriteEngine On
RewriteBase /
RewriteRule ^images/(.*)$ http://cdn.mydomain.com/$1 [L,R=301]
But this does not seem to be normal, because all images are incorrect.
So I Want to know the changes in this code. Any response would be greatly appreciated.
RewriteCond %{HTTP_HOST} ^yourdomain\.com$[OR]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteRule ^images\/?(.*)$"http\:\/\/cdn\.yourdomain\.com\/$1" [R=301,L]
But please note that this Just a temporary solution! In order to make the most of your CDN, you need to manually point images to the CDN to save an HTTP for each image.
I recently bought a CDN and performed Settings. In my website, images are stored in a folder named “images”, and the image URLs are obviously linked in this way. (*Example: images / some_image.png *)
< p>Since I want to use the CDN correctly, I need to rewrite the URL without manually changing each image path.
I tried a .htaccess code, which is recommended for similar problems
< p>
RewriteEngine On
RewriteBase /
RewriteRule ^images/(.*)$http://cdn.mydomain.com/$1 [L,R=301] pre>But this doesn't seem to be normal, because all images are incorrect.
So I want to know the changes in this code. Any response would be greatly appreciated.
p>This should work:
RewriteCond %{HTTP_HOST} ^yourdomain\.com$[OR]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteRule ^images\/?(.*)$"http\:\/\/cdn\.yourdomain\.com\/$1" [ R=301,L]But please note that this is only a temporary solution! In order to make the most of your CDN, you need to manually point images to the CDN to save an HTTP for each image.