bruckerrlb Posted July 8, 2008 Share Posted July 8, 2008 Hi All, I have a simple navigation question, how can I get my website to automatically go to the index.php page once the address is punched in, example www.example.com is entered into the browser, how can I automatically get it to go to www.example.com/index.php. My site has a javascript bug in it where it doesn't display properly if it just goes to the root without a site name. Any help would be much appreciated Thanks Rob Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/ Share on other sites More sharing options...
paulman888888 Posted July 8, 2008 Share Posted July 8, 2008 so this is an javascript error not a php. Or you want php to goto index.php instead of site.com/ if so it is not a php solution its HTML or JAVASCRIPT use this in your HEAD tags <meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com/index.php"> hope i helped Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584471 Share on other sites More sharing options...
rhodesa Posted July 8, 2008 Share Posted July 8, 2008 You can redirect it with lot's of methods: Apache's mod_rewrite, PHP header(), etc But, I would recommend fixing the JavaScript instead. If you agree, post where the JS bug is, and ask a Moderator to move this to JavaScript Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584475 Share on other sites More sharing options...
ag3nt42 Posted July 8, 2008 Share Posted July 8, 2008 are you sure this is a javascript bug.. or does your web server simply not have index.php listed in the default file list? Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584485 Share on other sites More sharing options...
bruckerrlb Posted July 8, 2008 Author Share Posted July 8, 2008 Thanks for all the responses. This is the company website, I had posted the javascript error in here a while ago and got some great feedback which helped me getting it functional. There is still a problem with the script, and I have no idea how to fix it, I'll post it in the javascript help again. As for this error causing it to not find the index.php site first, that's not the problem, the problem is I need it to go to index.php in order for the page to display properly, I'm not exactly sure why, but I"d like to get it working until I can get the javascript debugged. The only access I have is ftp, can I change the config through a ftp interface? Thanks again Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584601 Share on other sites More sharing options...
gigas10 Posted July 8, 2008 Share Posted July 8, 2008 edit the httpd.conf file? assuming your on apache. Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584615 Share on other sites More sharing options...
DarkWater Posted July 8, 2008 Share Posted July 8, 2008 Create a .htaccess file for the folder and put: DirectoryIndex index.php Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584617 Share on other sites More sharing options...
bruckerrlb Posted July 8, 2008 Author Share Posted July 8, 2008 thanks! and I just put the the htdocaccess file in the index, where all the other files are at? Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584626 Share on other sites More sharing options...
DarkWater Posted July 8, 2008 Share Posted July 8, 2008 Yes, name it ".htaccess". With the . in front. =P Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584643 Share on other sites More sharing options...
bruckerrlb Posted July 8, 2008 Author Share Posted July 8, 2008 Thanks, I went ahead and did that, named it .htaccess and then put DirectoryIndex index.php but when I uploaded it to my server, I got a "Wrong configuration" message about how it was wrongly configured. Is there anything I have to declare in the htaccess file? Thanks again Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584718 Share on other sites More sharing options...
jkewlo Posted July 8, 2008 Share Posted July 8, 2008 <?php header("location: index.php"); ?> Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-584833 Share on other sites More sharing options...
Guest Xanza Posted July 9, 2008 Share Posted July 9, 2008 all of these methods will work... But I recommend using the .htaccess file... Then you won't have to dick with it in subdirectories. Link to comment https://forums.phpfreaks.com/topic/113735-simple-navigation-question/#findComment-585015 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.