Can we replace portion of output url?


i have no knowledge in php language but id like to know if

let say (this just an example) I have piece of code as such

header('link: <'. $request->url(null) .'>; rel="alternate"');

this will generate on HTTP header status as

link: <>; rel="alternate"

is there any way for me (using PHP) to replace only part with a different string? example I set string for replacement as abcdef so the output result become

link: <https://abcdef/community/t/recaptcha-on-my-form-has-a-bug/395543>; rel="alternate"

What exactly are you trying to do?

replacing some string from the output

No there is no way if you are not the owner of the code

owner of the code? what do you mean?

Can you access the source code and change it on the server?

its on my server :smiley: …are you saying I’m hacking into people’s servers?

I bought a script on ThemeForest…there’s some minus in it and some modifications,for example, i need to print the mobile version of current page at different URL from to

Then I don’t understand your question.

You can replace the request->url() with whatever you want

it just an example and is taken from a different part of the script , it seems the code is used for canonical meta tag…i want to add an additional one as mobile alternate so the code doesn’t exist and I’m improvised a bit …

it just when I pasted into new line, i can’t change it into, like i said i don’t understand PHP but it seems the modification seems not heavy ,

Sorry but your sentence is like

“My car is not driving any more. I have no idea why and I am not a mechanic but it could not be a big problem so tell me how to solve it”

my question is …is there some kind of function on PHP than can replace string before it printed , I’m not asking people to solve my problem …

like I said earlier is there any way for me (using PHP) to replace only portion of string? …that the reason I said I don’t understand PHP , because I have no idea , I’m not asking people to solve it …

if there’s is, let say " oh you can use phpinfo; " then I’m going to read how it works…, or maybe “no, PHP cant do that”

so my apologies I f somehow I sounded like asking for people to solve my problem, but I didn’t…

and thank you for your answer, but just nevermind my question

Why do this in PHP? Why not just change the HTML?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.