I have several aliases (i.e. urls) for my website. For example, the site is mainsite.com. I have a few urls as aliases for mainsite.com, e.g. music.com, dance.com, etc.

Using $HTTP_REFERER, I have a php script which will tell me what url a visitor has entered. I can capture this as a variable and can use the variable to call the appropriate html page (using header).

I am calling this little php program tester.php.

What do I have to do so turn tester.php into index.html. In other words, when a visitor enters mainsite.com, I want them to go to tester.php.

Thanks in advance for your help.

Drexcol

    well..

    if your index file can be parsed as PHP then just do a header("Location: 'file to redirect to");

      easy!!!

      mv tester.php index.html

      then on your apache conf you should have a line like this

      <IfModule mod_php4.c>

      php_admin_value safe_mode 0

      AddType application/x-httpd-php .php .php4 .php3 .phtml .asp .htm .html
      AddType application/x-httpd-php-source .phps

      </IfModule>

      make sure you have .html on the x-httpd-php

      restart apache and you're done

        Dear Tasistro,

        Thanks for your prompt reply to my posting.

        I am a real PHP newbie. Basically, I'm just using it to enhance my flash website. So I hope my questions do not sound too foolish.

        My ISP uses Apache, I believe. Do I have to contact my ISP to make these changes in apache conf, or can I do it directly?

        If I follow your instructions, then will entering mainsite.com take me right to tester.php, which can then test which url the visitor has entered?

        I have looked through several php books but none of them seem to directly talk of these redirecting situations.

        Thanks for your help.

          Well depends on your ISP. You need to have access to the apache conf files probably through telnet (not very good) or ssh (very good). If your ISP doesn't give you access to the conf files then it must have some default extensions that will be parsed as php. Say:

          .php
          .php4
          .htm

          all you have to do is move tester to be say
          index.php4 or index.php

          So if you have a file named

          www.mainsite.com/index.php4 the moment I type

          www.mainsite.com I'll be taken to index.php4 which now holds the code from tester.php you do your url magick and it is done.

          Hope I'm being clear enough, feel free to ask for further clarification.

            Write a Reply...