1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

ok, a potentially tricky php question

Discussion in 'Web Design and Development (archive)' started by brianellisrules, Oct 22, 2003.

  1. macrumors regular

    #1
    well, it's probably not, but anyhoo....

    my main site will be: www.brianellisrules.com/index.php

    the code looks like this:
    PHP:
    <?php
    include('/home2/brian/public_html/head.inc');
    include(
    '/home2/brian/public_html/greymatter/index.inc');
    ?>
    greymatter/index.inc is the file automatically created by the blogger. usually it's a .htm file, but I changed it up during the conversion to php.

    so, when my main page loads up, I get the title/menu across the top and the blogger as the main body. perfect.

    however, the blogger has entries that can be commented and voted on. after voting, the blogger software does an automatic refresh by redirecting the browser to the main blogger directory (www.brianellisrules.com/greymatter/).

    since the main blogger file has been renamed to /greymatter/index.inc I was getting a simple directory listing.

    my work-around for this was putting a file in /greymatter/ called index.php (with code identical to that listed up top), so it would load automatically when the blogger/browser does the auto-refresh-redirect. low and behold, this actually works. I get the title/menus across the top and the blogger/news as the body.

    now for the part that bugs me. after all this, the address bar of the browser now reads "http://www.brianellisrules.com/greymatter/", rather than just "http://www.brianellisrules.com". and like I said, it's rubbing me the wrong way.

    is there a php command (or work-around) so that when the browser tries to load "http://www.brianellisrules.com/greymatter/index.php", it will automatically get redirected to "http://www.brianellisrules.com/index.php"?
     
  2. macrumors regular

    #2
    Ignore me because I'm a moron!





    I just used a server side redirect to kick it back to the main page! I feel reallllly dumb.
     
  3. Moderator emeritus

    Rower_CPU

    #3
    We didn't even have time to respond that time...

    See, you're getting better at this already. ;)
     
  4. macrumors 65816

    groovebuster

    #4
    Set a variable in the script that calls greymatter/index.php and on there you make a redirect if the variable is true. Without knowing anything about your php-app this seems to be the easiest way without messing too much with the existing code.

    groovebuster
     

Share This Page