Jump to content

[SOLVED] how can I check the url?


shedokan

Recommended Posts

<?php

  if (substr($_SERVER['SERVER_NAME'],0,3) == 'www') {
    echo 'www found';
  } else {
    echo 'www not found';
  }

?>

 

doesn't work I tried to echo $_SERVER['SERVER_NAME'] and one time I put the www and the other time I didn't and the result was the same both of the times and only echoed the url without www

This would be best handled via mod_rewrite. I actually dought that www.neostar.110mb.com is a valid address for your site, simply because your entire site runs in a subdomain, but anyway. Try...

 

RewriteEngine on
RewriteCond %{HTTP_HOST} ^neostar.110mb.com [NC]
RewriteRule ^(.*)$ http://www.neostar.110mb.com/$1 [L,R=301]

 

in your .htaccess file.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.