Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#57986 new enhancement

`got_url_rewrite` doesn't support Caddy V2

Reported by: sadpencil's profile sadpencil Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Permalinks Keywords:
Focuses: Cc:

Description

In Caddy V2, redirect about index.php file is automatically configured by default. However, wordpress does not detect Caddy in function got_url_rewrite so the permalink always has an 'index.php' in the middle.

See also: https://caddy.community/t/wordpress-pretty-permalinks-in-caddy-v2/18980/8

Change History (3)

#1 @sadpencil
2 months ago

Moreover, it could be better to provide a checkbox, allowing users to tell WordPress that it can assume redirects are applied without actually checking for it

#2 follow-up: @swissspidy
2 months ago

  • Version trunk deleted

Hi there and welcome to WordPress Trac!

How can WordPress detect whether the current web server is a Caddy server? Are there any functions it could check?

Moreover, it could be better to provide a checkbox, allowing users to tell WordPress that it can assume redirects are applied without actually checking for it

The got_url_rewrite filter is useful for this.

#3 in reply to: ↑ 2 @sadpencil
2 months ago

Replying to swissspidy:

Thanks for the response.

How can WordPress detect whether the current web server is a Caddy server?

$_SERVER['SERVER_SOFTWARE']

This string starts with 'Caddy/v2', e.g., 'Caddy/v2.6.4'

The got_url_rewrite filter is useful for this.

I know I can write a custom filter to override got_url_rewrite in my child theme's functions.php file. Just wondering if it is better to provide a checkbox in permalink page.

Last edited 2 months ago by sadpencil (previous) (diff)
Note: See TracTickets for help on using tickets.