From 9f0267758666e143baf2879a68971a46640ea056 Mon Sep 17 00:00:00 2001 From: MvdO79 Date: Tue, 13 Feb 2024 19:16:44 +0100 Subject: [PATCH] Update apache.md Added missing information about adding rewrite mapping to web.xml. As discussed in: https://github.com/cfwheels/cfwheels/discussions/1394 --- .../url-rewriting/apache.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/guides/handling-requests-with-controllers/url-rewriting/apache.md b/guides/handling-requests-with-controllers/url-rewriting/apache.md index a5c6aaf24c..86856dadfa 100644 --- a/guides/handling-requests-with-controllers/url-rewriting/apache.md +++ b/guides/handling-requests-with-controllers/url-rewriting/apache.md @@ -6,9 +6,24 @@ description: URL rewriting instructions for Apache ### Instructions for Apache -On most Apache setups, you don't have to do anything at all to get URL rewriting to work. Just use the following `.htaccess` file and Apache will pick up and use them automatically on server start-up. +First in your web.xml add the following servlet mapping above the default servlet mapping: -There are some exceptions though... +{% code title="web.xml" %} +``` + + + CFMLServlet + /rewrite.cfm/* + +``` +{% endcode %} + +For this you can use the global web.xml that for instance can be found at: /opt/lucee/tomcat/conf/web.xml. +Or, if you are on shared hosting, use a local web.xml that for instance can be found at: yourwebroot/WEB-INF/web.xml. + +After that use the following `.htaccess` file and Apache will pick up and use them automatically on server start-up. + +Most of the time this will work. There are some exceptions though... If you have installed Apache yourself you may need to turn on the rewrite module and/or change the security settings before URL rewriting will work: