Rewrite error in OpenCart 3.0.4.0 help

1. The problem I’m having:

I am encountering a rewrite error in OpenCart 3.0.4.0. No matter how I modify the settings and configurations, I am unable to achieve proper SEO-friendly URLs (URL rewriting) in OpenCart.

I would greatly appreciate it if someone with experience could help correct the code and point out any mistakes.


2. Error messages and/or full log output:


3. Caddy version:

caddy v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=

4. How I installed and ran Caddy:

a. System environment:

OS: Ubuntu 24.04.2 LTS

PHP version: v8.3.17

MySQL version: v8.0.41

Caddy version: v2.8.4


b. Command:

caddy run

c. Service/unit/compose file:

------------.

d. My complete Caddy config:

{
	# Ensure Coraza WAF loads first (commented out)
	# order coraza_waf first
}

https://xxx.com, https://www.xxx.com {
	# Access log configuration
	log {
		output file /var/log/caddy/access.log {
			roll_size 10MB
			roll_keep 3
			roll_keep_for 720h
		}
		format json
		level INFO
	}

	# Website root directory
	root * /var/www

	# Coraza WAF configuration (commented out)
	# coraza_waf {
	# 	include /etc/caddy/coraza/coraza.conf
	# 	include /etc/caddy/coreruleset/crs-setup.conf
	# 	include /etc/caddy/coreruleset/rules/*.conf
	# 	directives `
	# 	SecRuleEngine On
	# 	SecAction "id:900200,phase:1,nolog,pass,t:none,setvar:tx.anomaly_score_blocking=5"
	# 	SecRule REQUEST_URI "^/superman" "id:1001,phase:1,pass,nolog,ctl:ruleEngine=Off"
	# 	SecRule REQUEST_URI "^/index.php" "id:1002,phase:1,pass,nolog"
	# 	SecUploadFileLimit 10485760
	# 	`
	# }

	# Enable static file server
	file_server

	# Enable gzip compression
	encode gzip

	# Block access to var/storage/ directory
	@block_storage {
		path /var/storage/*
	}
	respond @block_storage "403 Forbidden" 403

	# Ensure static assets are served directly instead of being processed by PHP
	@static_files {
		path_regexp /\.(ico|gif|jpg|jpeg|png|webp|js|css|svg)$
	}
	handle @static_files {
		root * /var/www
		file_server
	}

	# SEO-friendly URL rewrite rules
	@rewrite {
		not path /admin*
		not path /image*
		not path /catalog/view/theme*
		not path /system*
		not path /robots.txt
		not path /sitemap.xml
		not path /favicon.ico
		not path /index.php
	}
	rewrite @rewrite /index.php?_route_={path}

	# Ensure the request checks for static files before passing to PHP
	try_files {path} {path}/ /index.php?{query}

	# PHP processing
	php_fastcgi unix//run/php/php8.3-fpm.sock

	# TLS certificate management
	tls {
		issuer acme
	}
}

5. Links to relevant resources:

• OpenCart SEO URL documentation: SEO keywords - OpenCart Documentation


:rocket: I would really appreciate it if someone could review my Caddy configuration and help me resolve the issue! Thank you in advance! :raised_hands:

We still don’t know what the issue is.