Jump to content

Recommended Posts

Posted

I'm just curious why $page->httpUrl returns

mysite.dev/about-us/

When it should return

mysite.dev/about-us

when the template's settting "Should page URLs end with a slash?" is set to "No"

I also noticed $page->url returns correctly

mysite.dev/about-us

 

Is that a bug with $page->httpUrl in the Processwire API or am I missing something?

Posted (edited)

Ok, Sorry, now I get what you wrote... I get the same behavior when changing the setting to "No", $page->httpUrl does return the trailing slash no matter what.

Edited by szabesz
typo
Posted

It does sound like a bug that needs fixing, but just wanted to add that you can get an equivalent of httpUrl in a way that respects the slash settings with:

$page->url(['http' => true]);

 

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...