How to link a href to new page /curentpage/newpage
Like - I want to make and when i click it it will go to /currentpage/newpage not to www.website.com/new
CodePudding user response:
First you need to get the current page URL.
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
$url = "https://";
else
$url = "http://";
$url.= $_SERVER['HTTP_HOST'];
$url.= $_SERVER['REQUEST_URI'];
Then you will concatenate new link with this url like this.
$url = $url.'/newpage';
Then you can add this url to href like this.
<a href="<?php echo $url; ?>">link</a>
CodePudding user response:
Its very simple!
<p>Hello <a herf = "xyz.com.xyz">this willl <a>lead u to my website<p>
have a good day/night! :)