Skip to main content


How to add a route with special characters?


!Friendica Developers I just wanted to implemented some more Mastodon API endpoint: docs.joinmastodon.org/methods/…

So I added this endpoint: /tags/{hashtag} - but this doesn't seem to cover any url like /api/v1/tags/%23PVgegenPutin The % is the problem here. How has the route definition has to be defined?

in reply to Michael Vogel

@Michael Vogel I don't know, but I'm surprised that you include the # in the hashtag (as %23). The examples seem to suggest the hashtag name is without the # symbol.

Friendica Developers reshared this.

in reply to Hypolite Petovan

I now realized that the problem isn't caused by the router. It's at the beginning where the pagename variable is set. I hope that you can solve this.

Friendica Developers reshared this.

in reply to Michael Vogel

@Michael Vogel It looks like we need to add the B flag to the RewriteRule statment in the .htaccess file.

Not sure about nginx though.

Friendica Developers reshared this.

in reply to Hypolite Petovan

@Michael Vogel I just confirmed the B flag does the trick. You need to update the .htaccess-dist file and we'll need to add this change to the release notes because it needs to be applied to production files that we do not control (ping @Tobias )

Friendica Developers reshared this.

in reply to Hypolite Petovan

Can you provide a PR? I'm not sure where to add this B here:
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]

Friendica Developers reshared this.

in reply to Michael Vogel

@Michael Vogel Here you go:
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA,B]

Friendica Developers reshared this.

Unknown parent

Hypolite Petovan
@Tobias @Michael Vogel Can you please add this to your current changes?

Friendica Developers reshared this.

in reply to Marek Bachmann

@Marek Bachmann :friendica: @utzer ~Friendica~ What happens when you navigate to the following URL: friendica.mbbit.de/calendar/%2…

If you see your own calendar, nginx needs a fix for URL-encoding the pagename parameter when rewriting URL. If you see a "Not Found" error page, it's working as expected.

Friendica Developers reshared this.

in reply to Hypolite Petovan

Seems fine, but my last pull from dev was a day ago. That's the result:

Friendica Developers reshared this.

Unknown parent

Hypolite Petovan
@Tobias Thank you for checking! It seems only Apache needed a change then.

Friendica Developers reshared this.