• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

stripping out the .co and leaving .uk

Status
Not open for further replies.

PaullasPaullas is verified member.

Acorn Moderator
Nominet Member
Nominet Registrar
Hosting Provider
Domain Marketplace
Parking Service
Joined
Jul 13, 2004
Posts
5,928
Reaction score
467
can anyone help as im stumped.

what i am trying to do is on parked domains just show the domain name and .uk, for exmaple when going to wrapz.co.uk on the page it only shows wrapz.uk.

The code i am using is this:

<?php
$domainstart = $_SERVER['HTTP_HOST'];
$domainname = str_replace("www.", "", "$domainstart");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><? echo "$domainname"; ?></title>
</head>

<body>
<div align="center"><? echo "$domainname"; ?> -
<a target="_blank" href="http://wrapz.co.uk/" style="text-decoration: none">
</body>
</html>
 
Change

PHP:
$domainstart = $_SERVER['HTTP_HOST'];
$domainname = str_replace("www.", "", "$domainstart");

to

PHP:
$domainstart = $_SERVER['HTTP_HOST'];
$remove = array("www.", ".co");
$domainname = str_replace($remove, "", $domainstart);
 
Also the link within the body tags has no closing </a> or </div> tags and wrapz.co.uk has not been replaced with $domainname. So presumably you want something like this:

<div align="center">
<a target="_blank" href="http://<? echo "$domainname"; ?>/" style="text-decoration: none"><? echo "$domainname"; ?></a></div>
 
You also need to remove quotes on echo "$domainname".

It is just echo $domainname
 
Thanks guys, really appreciate your help.
 
Status
Not open for further replies.
Top Bottom