- June 28, 2024
- Posted by: iSummation Team
- Category: ColdFusion
Recently I was working with site migration from Windows to an Ubuntu server. After renaming the file name accordingly everything works fine except for one project. While working with Windows we never take care of file name cases since it does not matter in Windows. Although we use a standard for file naming, mistakes will not be revealed. After renaming the file name accordingly everything works fine except for one project. In this project, I was running ColdBox framework in the root folder for all kinds of administrative work or business management and there was a folder /website that contained a public website. Front website running under MURA cms. When we move to RAILO and UBUNTU home page loads correctly, but the rest of the pages show a 404 error.
- Since we were not using index.cfm in url required to make changes in .ππππππππ file to make sure the URL was correctly rewritten. Below is .ππππππππ code
Options +FollowSymLinks
RewriteEngine On
DirectoryIndex index.cfm
RewriteRule ^$ /website/ [R]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^website/([a-zA-Z0-9/-\s]+)$ /website/index.cfm/$1 [PT]
Added “website/” in the last rule to make sure the rule only applies to requests starting with the website and the rest of the part will be considered as URL parameters for MURA to handle it. Anyhow there were two index.cfm added in URL after rewrite rule executed.
- Let us say the URL I am trying to access is
http://example.com/website/privacy/ - And is received as below in MURA
http://example.com/website/index.cfm/privacy/index.cfm
Notice two index.cfm inside the URL and this was causing a 404 error since Apache/Tomcat looking for index.cfm under privacy folder which doesn’t exist. I was not able to find what added index.cfm at end. I am sure that RewriteRule was correct and created the correct URL. After googling it turned out that TOMCAT (yes TOMCAT) was adding index.cfm at the end. Since by default, Tomcat allows SES mapping from the root of the web application only you are required to add new <πππ-πππππππ> in web.xml file.
Through MURA Installer the MURA CMS installation is extremely easy and simple. MURA Installers setup process is quite easy and compatible with ColdFusion, Railo or OpenDB. If your Web Server or Servlet Container does not support the URL extension including parameters after index.cfm, otherwise you can use a shorter URL without index.cfm, you must configure the webserver for URL rewrites using Apache πππ_πππ ππππ or πππππ-πππ ππππ.
RESOLUTION:Β
Search for comment Basic SES Mapping in web.xml file and add <πππ-πππππππ>/π ππππππ/πππππ‘.πππ/*</πππ-πππππππ>. Now it should allow you to SES mapping from the website folder as well.
While migrating a website from Windows to an Ubuntu server, most aspects worked seamlessly except for one critical issue. Historically, Windows’ case insensitivity with file names masked discrepancies that only surfaced when transitioning to Ubuntu. Specifically, a project utilizing ColdBox framework encountered URL errors post-migration to RAILO and Ubuntu. Despite configuring Apache’s .htaccess correctly for URL rewriting, unexpected “index.cfm” duplications in URLs led to persistent 404 errors.
Upon investigation in CFML development, it became evident that Tomcat automatically appended “index.cfm” due to default SES mapping limitations. To resolve this, a specific <πππ-πππππππ> was added in the web.xml file, enabling SES mapping from the “/website” directory. This adjustment effectively aligned Tomcat’s behaviour with the URL rewriting rules, ensuring proper functionality of the MURA CMS installation.
In conclusion, while challenges arose during the migration process, diligent configuration adjustments tailored to the server environment proved instrumental in achieving seamless operation of the website on Ubuntu with Tomcat.