Putting URL on page
Anyone know if it's possible to automatically put the current URL into the page. Say I want a landing page with the domain on it, but don't want to handcraft each page for each domain.
Thanks in advance
Anyone know if it's possible to automatically put the current URL into the page. Say I want a landing page with the domain on it, but don't want to handcraft each page for each domain.
Thanks in advance
kazimmerman posted this at 10:32 — 5th May 2009.
He has: 698 posts
Joined: Jul 2005
This would actually require a little basic PHP. Assuming you have that available for all of your domains, you can insert the following line into the pages to display the web address:
<?php
echo "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
?>
And obviously if you want to turn that into a link, you could wrap it in
<a>
tags like this:<?php
$url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
//Just setting it to a variable so I don't have to keep typing it
echo "<a href='".$url."'>".$url."</a>";
?>
Kurtis
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.