I’d like to request a feature: URL rewriting (not forwarding) for page rules.
The first URL is the URL that would appear on my website. But Cloudflare would look for the content on the origin using the 2nd URL. The content would be returned from the original URL without a redirect.
This would be useful because at scale, it’s easiest to use a UUID for image names. But it’s also useful to include relevant keywords in an image file name for better SEO. This allows use of keywords and easily updating the keyword format if needed without changing file names on disk, the original images on disk always use the same UUID which never changes.
This would be hugely useful!
This doesn’t solve your request fully, but it might be useful info. It appears your concern is updating the image later, or changing the keywords of file name.
You can mix both UUID and SEF name, and keep CF out of it. What I do for projects like this is store the file with both the SEF name and UUID. Such as
some-useful-seo-keywords_123e4567-e89b-12d3-a456-426655440000.png. I use the underscore as a delimiter.
In the CMS, it’s easy to rename the file. Simply list that directory and filter for “_UUID.” - and rename that resulting file appropriately.
And if you have to change the image, you again filter the directory for “_UUID.”, and save the new image with the exact name with overwrite.
Filtering on the UUID to manage the file is an extra step in the CMS coding, but I can tell you from experience that it works well.
Live example: https://www.google.com/search?q=Faulhaber+BP4+series+BLDC+Servo-motors&tbm=isch ( https://www.motioncontrol.com/media/releases/2017/faulhaber-bp4-series-bldc-servo-motors_512A7FA0-5056-A818-6212AC62E81C5B88_main.jpg )
You’ll see the first image is from a site I built. The image file name is faulhaber-bp4-series-bldc-servo-motors_512A7FA0-5056-A818-6212AC62E81C5B88_main.jpg
I have another delimiter there, so I know which image to server and modify. _main, _thum, etc. If the SEF changes I can modify all - based on the UUID and _size.
Thanks but the goal is to avoid rewriting image file names on disk if needed (for example, if product data or targeted keywords change) since it creates more moving parts and thus is more error prone. This also allow better keyword density in the filename.
I appreciate the response though!
I respectfully disagree on both points.
- It’s not error prone if your code is clean. The filename has the ID that matched the database record.
- My version has better keyword density because your idea puts the keywords as being in a folder named by the ID.
Whereas mine has the keywords before any ID.
Closer to the root is better for seo. And
"123e4567-e89b-12d3-a456-426655440000" as a folder name is not helpful for seo.
Aside from all that… why not do rewriting on the server instead of at Cloudflare?
I also want this feature, but for a different reason. I’m using a number of services whose output is some page (e.g., a landing page for a new product). This page is hosted by the service and they give me an address like
http://service.com/my-username/my-new-product. I want to be able to setup Cloudflare such that I can give my users the address
https://my-new-product.mydomain.com/ and have them see the landing page hosted by the third party service, while still seeing my branded domain name in the address bar. I don’t want my users to see
service.com/... in the address bar, or the third party service’s SSL cert (if they even have one).
It’s valid for both @micah and @jborseth, but take a look at Workers, with those you can do whatever you want.
Hmm, interesting. Where is the best place to get assistance (community or professional) to help with authoring a rewrite rule?