Wordpress almost pretty permalink

I’m trying to change:


This is my caddyfile:

domain.something {
    root /var/www/domain
    tls admin@domain.something
    fastcgi / /var/run/php/php7.0-fpm.sock {
    ext 	.php
    split	.php
    index	index.php }
    rewrite / to {path} {path}/ /index.php?{query}
    rewrite if {path} not_match ^\/wp-admin to {path} {path}/ /index.php?_url={uri}
    rewrite r ^\/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\/(.*) to /{4}

I’m working on ubuntu 16.04, Caddy 0.10.6, php7, Wordpress 4.8.1


Hi @bartoszsdb, welcome to the Caddy community. I’ve edited your post slightly to put code blocks (triple backticks, ```) around your Caddyfile to make it more readable.

It’s possible it wasn’t formatted correctly after you pasted it, but the config you’ve shared is missing a few curly braces ({ and }) around the rewrite subdirectives. I’m assuming that Caddy gives you an error when you try to start it if that’s the case.

I’m guessing that, once fixed, the rewrite to {path} {path}/ /index.php?_url={uri} should handle that already - but to allow /some-post/ to return /index.php/some-post/, without handling any other concerns, that would look like this:

rewrite {
	r ^/([a-z0-9]+)/$
	to /index.php/{1}/
1 Like

Thanks, works fine :smile:

So what was the final caddyfile ? I am trying to achieve this too, and I can’t quite piece together what @Whitestrake and you figured out. Care to elaborate?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.