Jump to content

Check Canonical url


phpnerd

Recommended Posts

Hi All,

        I am looking for a script in php which can check whether an url is www or non www. I have searched extensively in google but nothing conclusive has appeared.

 

        It would be of great help if someone can throw light into this.

Link to comment
Share on other sites

This is why people should learn to think instead of wasting there time copying code from tutorials.

 

What do you need to do?

 

1) Get the current url. - The $_SERVER array is the place to look.

2) Check to see if it start with the string 'www'. substr will help you do this.

 

I'm not going to provide the code for you because it won't help you.

Link to comment
Share on other sites

Why learn to code when you can simply C+P from a tutorial? If anything goes wrong, just post in a forum like this. Eventually you'll find someone silly enough to code for you for free. Web security should be taken care of in a language as complex as PHP :D

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.