If you’ve ever worked on your own personal web server and a remote server at the same time, then you’ve probably had the same files on both at the same time as well. With multiple open browser tabs/windows with duplicate titles, it can be difficult to tell at a glance whether you’re looking at a locally hosted page or a remotely hosted page.
There’s an easy way to automatically format your titles so that you can quickly see where your page is being hosted. Follow the simple code below to format your titles.

In your HTML code where you normally have <title>My Homepage</title>, instead, copy and paste this line:
<title><? $servername = $_SERVER['SERVER_NAME']; echo ($servername=="localhost") ? "{Localhost}" : ""; ?> My Homepage</title>
Change “Localhost” and “My Homepage” to read anything you’d like (Sandbox, Testing Environment, etc). This works great inside your WordPress template as well (header.php).
![]()



![[del.icio.us]](http://www.elledoesit.com/wpress/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.elledoesit.com/wpress/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://www.elledoesit.com/wpress/wp-content/plugins/bookmarkify/facebook.png)
![[StumbleUpon]](http://www.elledoesit.com/wpress/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.elledoesit.com/wpress/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://www.elledoesit.com/wpress/wp-content/plugins/bookmarkify/twitter.png)
View post
Add a Comment