Skip to main content

Posts

Showing posts from February, 2024

Caddy web server configuration for rewrite with multiple variables parameters

  http://localwebsite {         # Set this path to your site's directory.         #root * /usr/share/caddy         root * /var/www/website           #makes /course/id/name.html to /course.php?id=id&name=name         @zxp {                 #path_regexp myregex ^/course/(\d+)/([%A-Za-z0-9_-]+)\.html$                 path_regexp myregex ^/course/([^/]+)/([^/]+)\.html$         }         rewrite @zxp /course.php?id={re.myregex.1}&name={re.myregex.2}           # rewrite /course/([^/]+)/([^/]+)\.html /course.php?id={1}&name={2}         # rewrite /course/(\d+)/([A-Za-z0-9_-]+)\.html /course.php?id=$1&name=$2         # rewrite /course/(\w+)/(\w+)\.html /course.php?id={1}&name={2}         #rewrite /course {         #       r ^/(\w+)/(\w+)\.html$         #       to /course.php?id={1}&name={2}         #}         # Enable the static file server.         file_server         # Another common task is to set up a reverse proxy:         # reverse_proxy localhost:8080