Created
May 8, 2022 03:53
-
-
Save Sharifur/6d0bb03ae79803c22a716e3cf928d4a1 to your computer and use it in GitHub Desktop.
canonical url generate for laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function canonical_url() | |
{ | |
if (\Illuminate\Support\Str::startsWith($current = url()->current(), 'https://www')) { | |
return str_replace('https://www.', 'https://', $current); | |
} | |
return str_replace('https://', 'https://www.', $current); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment