This should work fine or just use relative paths.
You can also implement alternative approaches, for example, you can have your hyperlinks like:
// this part could be established in a shared header/include/global variable for your scripts $site_domain = 'http'; if ($_SERVER["HTTPS"] == "on") {$site[url][full] .= "s";} $site_domain .= "://"; $site_domain =$site_domain .$_SERVER['SERVER_NAME']; // you would then have links in your scripts coded as: $site_domain."/cleanurl/
$ site_domain gives you a link to the base domain, dynamic wherever the scripts are located, you can make your own links: $site_domain."/cleanurl/";
Where " cleanurl " is a link to the page you want to download (for example, "news", for example, at www.mydomain.com/news/).
You can then use .htaccess and Apache mod_rewrite for processing, where these URLs subsequently indicate:
RewriteEngine On RewriteRule ^cleanurl/$ /url/to/file/i/want.php [NC,L]
Since relative paths are used from the root directory in .htaccess, you will not need to make any changes after installation.
Another advantage of this is that you also get “clean”, “readable” links - and if you go where the scripts are located relative to your file structure, you don’t have to go, although all the scripts that link to them, and edit the links separately - you only need to change one line in your .htaccess.
source share