|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
MajorONY Smarty n00b
Joined: 03 Aug 2021 Posts: 1
|
Posted: Tue Aug 03, 2021 11:50 am Post subject: canonical url problem REQUEST_URI |
|
|
Hi,
I have this code:
Code: | {if $smarty.server.REQUEST_URI|strstr:"post"}
<link rel="canonical" href="https://{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}" />
{/if} |
To each url is attached: ?page_type=post
How can I make the url be:
https://domain.com/blog/post/1_test
I want to remove ?page_type=post |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Sep 08, 2021 1:36 pm Post subject: |
|
|
Create a wrapper function around https://packagist.org/packages/anrdaemon/net-url or any other similar URL handling library.
For Net\Url:
Code: | $query = $_GET;
unset($query['page_type']);
$url = AnrDaemon\Net\Url::fromHttp( [ 'query' => $query ] );
print $url; |
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|