Provides a simple method of rewriting the URLs of assets. This was developed primarily for use with the SilverStripe S3 assets module, allowing a quick method of using a CloudFront distribution to serve assets instead of linking directly to the S3 bucket.
composer require dorsetdigital/silverstripe-url-rewriter
dev/build?flushto update your project
The module won't make any changes to your site unless you do a bit of configuration. There are a few options you can set, done in a yml file:
--- Name: rewriteconfig --- DorsetDigital\URLRewriter\Middleware: rewrite_enabled: true old_url: 'https://old.example.com' new_url: 'https://cdn-distribution.example.com' enable_in_dev: true
The options are hopefully fairly self explanatory:
rewrite_enabled- globally enables and disables the module (default false - disabled)
old_url- the full URL you wish to rewrite (eg. https://somebucket.s3.aws.com)
new_url- the new URL you wish to use (eg. https://somedistribution.cloudfront.net)
enable_in_dev- enable the CDN in dev mode (default false)
X-Rewrites: Enabledto show that it's working, even if none of the other rewrite operations are carried out. If this is not present and you think it should be, ensure that you have set
cdn_rewriteto true, that you have specified the
cdn_domainin your config file and that you have
enable_in_devset to true if you are testing in dev mode.
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem