How to override htacess file config (apache)

1. Output of caddy version:

V2 Latest

2. How I run Caddy:

I run caddy as a server

a. System environment:

Docker on QNAP

d. My complete Caddy config:

Caddy file

http_port 8080
https_port 8443
} {

} {
root * /www/
encode gzip


3. The problem I’m having:

I am trying to run fancy url on my website and remove ?id= from the url with multilevel pages that it is like this:

And I would like to run it like this
or etc...

When fancy url are turned on, the link does go the the page, like this, but the website content does not change to the content of page

4. What I already tried:

I have tried everything, all rewrite options, redirect options on the caddy documentation, everything on this forum, but nothing seems to work.

My htaccess file rewrite rules
RewriteBase /

  • RewriteCond %{REQUEST_FILENAME} !-f*
  • RewriteCond %{REQUEST_FILENAME} !-d*
  • RewriteRule /?([A-Za-z0-9_-]+).html$ index.php?id=$1 [QSA,L]*

5. Links to relevant resources:

Caddy is not Apache. .htaccess rules don’t work with Caddy. That’s an Apache thing.

To make that work, then you should change your PHP app to read from $_SERVER['REQUEST_URI'] which will have the original URL as Caddy received it, then your PHP app can decide how to route the request.

Well, thanks for the response. But I don’t know what to do because all the requests from the CMS that I use have $_SERVER[‘REQUEST_URI’] on their main php files.

This topic was automatically closed after 30 days. New replies are no longer allowed.