Very probably this is impossible, but I want to ask it, just in case.
I have a database in which I save some numbers (1, 2, 3...).
I have a .php
page from which I read the numbers. I concat those numbers to a string for getting a full URL. For exmaple:
$intArticle = $row["article"];
$strURLBase = "example.com/index.php/"
$strLink = $strURLBase . $intArticle;
//And I get "example.com/index.php/1"
But now, there is an exception in which the URL points to an external website, so my code is not valid for now.
I know how to fix it in .php
, but I would like to know if it is possible to make the redirect directly inside the URL, saving the properly string inside the database. For example:
$intArticle = $row["article"]; //In this case, the value of $row["article"] could be, for example, "http://www.externalweb.com"
$strURLBase = "example.com/index.php/" //This part should be ignore inside the URL
$strLink = $strURLBase . $intArticle;
//I would get "example.com/index.php/http://www.externalweb.com"
Is there any kind of instruction that I could write inside the URL (that I would save into the database and then I would concat to $strURLBase
) that redirects to another URL? For example:
example.com/index.php/!$%&_redirec_to("http://www.externalweb.com")
I don't want to call any PHP function from the URL for the redirection. In fact any PHP code shouldn't be executed. Everything should be inside the URL.