Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    61

    Unanswered: find out browser url using php

    I want to run a script on my webpage that does something like:

    if browser URL = http://www.domain.com { do task1 }
    if browser URL = http://domain.com { do task2 }

    I remember seeing this somewhere about a year ago but now I can't find that php function. Was it header?

  2. #2
    Join Date
    Sep 2005
    Posts
    5
    $PHP_SELF will get the url

  3. #3
    Join Date
    Feb 2004
    Posts
    533
    If you have an Apache web server with mod rewrite available then you can use this method.
    More info at http://no-www.org/

    All you need to do is create or modify a file called .htaccess located in the root directory of your site and add the following lines, change to match your domain.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
    ~

    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •