Report this

What is the reason for this report?

How to use mod_rewrite in .htaccess on CloudPanel domain

Posted on September 5, 2020

I’m currently migrating a CodeIgniter website to a CloudPanel droplet. On that website, I have added two rewrite rules in the standard CI .htaccess file in the public folder:

RewriteRule ^css/(.*)\.[0-9]+\.css css/$1.css [L]
RewriteRule ^js/(.*)\.[0-9]+\.js js/$1.js [L]

The purpose of this is to give the css and js assets a timestamp to force browsers to updated cached assets if there are new versions.

This works well both on the old server and on my localhost server, but on the CloudPanel domain the files are not found.

If I manually write the address in the browser and remove the timestamp, I find the files.

I’ve seen from other threads here that I might have to use some console commands to change the apache settings to allow rewriting urls. But I am wondering if there is a setting in CloudPanel that I should be using.

Is there a setting in CloudPanel I need to change to allow rewrite rules in .htaccess?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.