I would like to convert an absolute path into a relative path.
This is what the current absolute code looks like
$sitefolder = "/wmt/";
$adminfolder = "/wmt/admin/";
$site_path = $_SERVER["DOCUMENT_ROOT"]."$sitefolder";
// $site_path ="//winam/refiller/";
$admin_path = $site_path . "$adminfolder";
$site_url = "http://".$_SERVER["HTTP_HOST"]."$sitefolder";
$admin_url = $site_url . "$adminfolder";
$site_images = $site_url."images/";
so for example, the code above would give you a site url of
www.temiremi.com/wmt
and accessing a file in that would give
www.temiremi.com/wmt/folder1.php
What I want to do is this I want to mask the temiremi.com/wmt and replace it with dolapo.com, so it would say www.dolapo.com/folder1.php
Is it possible to do that with relative path.
I’m a beginner coder. I paid someone to do something for me, but I want to get into doing it myself now.
The problem is that your question, although it seems very specific, is missing some crucial details.
If the script you posted is always being executed, and you always want it to go to
delapo.cominstead oftemiremi.com, then all you would have to do is replacewith
The
$_SERVER["HTTP_HOST"]variable will return the domain for whatever site was requested. Therefore, if the user goes towww.temiremi.com/myscript.php(assuming that the script you posted is saved in a file calledmyscript.php) then$_SERVER["HTTP_HOST"]just returnswww.temiremi.com.On the other hand, you may not always be redirecting to the same domain or you may want the script to be able to adapt easily to go to different domains without having to dig through layers of code in the future. If this is the case, then you will need a way to figuring out what domain you wish to link to.
If you have a website hosted on
temiremi.combut you want it to look like you are accessing fromdelapo.com, this is not an issue that can be resolved by PHP. You would have to havedelapo.comredirect totemiremi.comor simply host ondelapo.comin the first place.If the situation is the other way around and you want a website hosted on
delapo.combut you want users to accesstemiremi.com, then simply re-writing links isn’t a sophisticated enough answer. This strategy would redirect the user to the other domain when they clicked the link. Instead you would need to have a proxy set up to forward the information. Proxy scripts vary in complexity, but the simplest one would be something like:So you see, we really need a little more information on why you need this script and its intended purpose in order to assist you.