如何用点直接错误域来纠正域名

Im PHP user... =) How can i make correct forward to right domain after people wrong typing?

Example:

Wrong URL:

http://www.somedomain.com.
http://www.somedomain.com./
http://www.somedomain.com,
http://www.somedomain.com,/

forward to proper:

http://www.somedomain.com

edited: Im PHP user...

i found answer...

here's my solution: (For PHP user)

if ('http://'.$_SERVER['HTTP_HOST'].'/' == 'http://'.substr($_SERVER['HTTP_HOST'],0,-1).'./')
{
    if ($_SERVER['QUERY_STRING'] != null)
    {
        $QUERYSTRING = '?'.$_SERVER['QUERY_STRING'];
    }

    header('Location: http://'.substr($_SERVER['HTTP_HOST'],0,-1).$_SERVER['PHP_SELF'].$QUERYSTRING);
}

The first two are not wrong. For the second two, rewrite the browser.

If they make that mistake then its out of your hand. The DNS lookup will fail and they will never make it to your site to be redirected anywhere.

Although depending on the browser, it might correct the URL for them, but that is still out of your control and by the time they get to your site they will have the correct domain name.

If you're talking about domain names that are entered into an internet browser, you need to control the DNS server that is used by either that browser or the system that is running the browser. That could be done with DNS forwarding then.

As an alternative, you can extend the browser with that functionality.

PHP running on your server has almost nothing to do with that.