5kyy8lu3 Posted August 3, 2009 Share Posted August 3, 2009 Hi. I'll try to word this as best I can. I'm just playing around with some layouts I've come up with especially php structure. I decided to try to make a site that runs completely from index.php and links just goto a page that sets a session variable, then uses header to go back to index.php where php file(s) are include()'ed depending on what's in the session variable in a big switch statement. why? i just wanted to try it. the biggest thing i wanted was for the name of the document to not be visiable (index.php, etc). when i have header set to this: <?php header("Location: index.php"); ?> it works fine. but this makes index.php show up after the domain in the address bar like this: http://www.domain.com/index.php so i try this: <?php header("Location: http://domain.com"); ?> but when I have header direct to the domain instead of the specific index.php file, the session variable won't load. i have the page echo the session ID and it doesn't change but the contents of the variable won't carry over for some reason. i change header back to index.php and it works fine. any ideas? (keep in mind I know there isn't much risk to allowing index.php be visible, I just wanted to see if it's possible so until it's possible or not possible it's going to bug me. must....find...out...how...) thanks =) Link to comment https://forums.phpfreaks.com/topic/168585-session-variables-and-header-pointing-to-domain-name-not-php-file/ Share on other sites More sharing options...
phpSensei Posted August 3, 2009 Share Posted August 3, 2009 It can be done using Friendly Url... mod_Rewrite (http://en.wikipedia.org/wiki/Rewrite_engine) in the .htaccess file. Link to comment https://forums.phpfreaks.com/topic/168585-session-variables-and-header-pointing-to-domain-name-not-php-file/#findComment-889399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.