username – How to add @ symbol to user url


There’s no such thing as a literal @ in that part of a URL, you have to URL encode it. Sometimes browsers will decode it for you so it looks ok but it’s just being helpful. The only time you can use it without encoding is when specifying the username and password in a URL e.g. otherwise it has to be URL encoded as a %40.

If you modify the regular expressions to also match against @ it still won’t work because the @ will be converted into %40 before it’s sent to the browser.

Thankfully if you try to add the @ in manually WordPress is smart enough to redirect you to the page that is closest, which is usually the author archive of the same user.

Also be wary of that code, removing the /author/ portion of the rule will mean that /test-page/ will also match author archives and you will get clashes that either turn every page into an author archive, or prevent author archives working.

vivi 2 months 2021-12-04T16:17:46-05:00 0 Answers 0 views 0

Leave an answer