PDA

View Full Version : ok, a potentially tricky php question


brianellisrules
Oct 22, 2003, 07:39 PM
well, it's probably not, but anyhoo....

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

the code looks like this:
<?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"?

brianellisrules
Oct 22, 2003, 10:25 PM
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.

Rower_CPU
Oct 22, 2003, 11:30 PM
We didn't even have time to respond that time...

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

groovebuster
Nov 7, 2003, 02:41 AM
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