Page 1 of 1
OpenCart 4.1.0.0, but SEO URLs are not working no matter how can I configure them (using Caddy)
Posted: Wed Mar 05, 2025 7:23 am
by liuhu1985
I using Caddy 2.8.4 + PHP 8.3.17 + MySQL 8.0.41 + OpenCart 4.1.0.0, but SEO URLs are not working no matter how can I configure them. The issue is:
• Only the homepage loads correctly.
• All other pages either return 404 or fail to recognize the SEO URL.
my Caddyfile rewrite rule is:
Code: Select all
@notStatic {
not path *.jpg *.jpeg *.png *.gif *.webp *.ico *.css *.js *.svg *.woff *.woff2 *.ttf *.eot
not path /image/* /system/* /assets/* /admin /admin/*
not file {path}
}
rewrite @notStatic /index.php?_route_={uri}
Use curl -I to access, status code 200.
my expect Caddy to correctly process SEO-friendly URLs, but it doesn’t seem to be working. How can this be fixed?
Re: OpenCart 4.1.0.0, but SEO URLs are not working no matter how can I configure them
Posted: Wed Mar 05, 2025 6:20 pm
by by mona
OC4 is not recommended in any version for production sites.
It has a lot of bugs and is not stable.
The recommended stable OC version is 3.0.4.0 which can be downloaded here =>
https://www.opencart.com/index.php?rout ... ad/history
More information is needed. You have not mentioned if you set SEO urls in settings. If you have SEO urls entered.
For more information on how to set up SEO urls you can see the documentation =>
https://docs.opencart.com/en-gb/administration/seo/
Or search google =>
https://www.google.com/search?q=how+to+ ... n+Opencart
I have never used Caddy and you might be better asking here =>
https://caddy.community/
Re: OpenCart 4.1.0.0, but SEO URLs are not working no matter how can I configure them
Posted: Wed Mar 05, 2025 10:21 pm
by JNeuhoff
You need to implement this Apache .htaccess equivalent in Caddy:
Code: Select all
## SEO URL Settings
RewriteEngine On
## If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
## Rewrite Rules
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|webp|js|css|svg)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Please post in the Caddy forum for help.
Re: OpenCart 4.1.0.0, but SEO URLs are not working no matter how can I configure them (using Caddy)
Posted: Thu Mar 06, 2025 10:43 pm
by liuhu1985
{
# Ensure Coraza WAF loads first (commented out)
# order coraza_waf first
}
https://xxxcom, 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 system/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
}
}Thanks for your response! I’m still struggling with this part. Could you help modify the code?
Re: OpenCart 4.1.0.0, but SEO URLs are not working no matter how can I configure them (using Caddy)
Posted: Thu Mar 20, 2025 5:30 pm
by rusy658
can u pls explain me more
e-zpassnh com
Re: OpenCart 4.1.0.0, but SEO URLs are not working no matter how can I configure them (using Caddy)
Posted: Fri Mar 21, 2025 7:17 pm
by paulfeakins
liuhu1985 wrote: ↑Wed Mar 05, 2025 7:23 am
I using Caddy 2.8.4 + PHP 8.3.17 + MySQL 8.0.41 + OpenCart 4.1.0.0
OpenCart 4.1.0.2 has just been released, it *may* fix the issue?