Jump to content

[SOLVED] how can I check the url?


shedokan

Recommended Posts

A revised version...

 

<?php
if(strpos($_POST['string'], "www.") !== FALSE)
{
echo "Yes they did";
}
else
{
echo "No they didn't";
}
?>

 

EDIT- oh you mean in the url that they used to enter the page lol. In that case thrope is right.

 

Orio.

Link to comment
Share on other sites

<?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

Link to comment
Share on other sites

Thats wierd. I use that exact same variable to determin which configuratiosn to load for my framework. eg dev.domainname.com loads my developement version stage.domainname.com loads the staging configuration.

 

Never had a problem with it.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.