jokerfool Posted February 14, 2008 Share Posted February 14, 2008 My host recently updated to php5 and I am having some issues on my site. When a user visits a link e.g. blahabc.com/abc they're referred automatically to my default 404 page, thus the user now has to add the index.php extension after abc making it blahabc.com/abc/index.php Now in my htaccess file is it possible to write something in there so when a user goes to blahabc.com/abc they're redirected to blahabc.com/abc/index.php? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/ Share on other sites More sharing options...
Daniel0 Posted February 14, 2008 Share Posted February 14, 2008 You can put this in it: ErrorDocument 404 /error/404.html Change the path to whatever the path to your error document is of course. See: http://httpd.apache.org/docs/2.2/mod/core.html#errordocument Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-466588 Share on other sites More sharing options...
jokerfool Posted February 14, 2008 Author Share Posted February 14, 2008 If a user goes to the wrong path or even a path with just a folder .com/abc then at the moment they're redirected to my default 404 page which is fine. What I wont to know is in the .htaccess file is there a command I can add so if a user goes to .com/abc then they're redirected automatically to .com/abc/index.php and not sent to the 404 page? Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-466590 Share on other sites More sharing options...
jokerfool Posted February 14, 2008 Author Share Posted February 14, 2008 Can someone shed some light on this please? Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-466665 Share on other sites More sharing options...
Daniel0 Posted February 14, 2008 Share Posted February 14, 2008 As long as abc is a folder then it should do that already. Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-466721 Share on other sites More sharing options...
jokerfool Posted February 15, 2008 Author Share Posted February 15, 2008 But it doesnt do that, even if I add: <Files index.php> forcetype application/x-httpd-php </Files> To the htaccess file when the page loads it tries to download the index file too. Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-467382 Share on other sites More sharing options...
Daniel0 Posted February 15, 2008 Share Posted February 15, 2008 Could you post a link to your site so I can see? Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-467449 Share on other sites More sharing options...
Stooney Posted February 15, 2008 Share Posted February 15, 2008 put this in a .htaccess file Directory Index index.php you can change that to be any filename you wish. Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-467478 Share on other sites More sharing options...
jokerfool Posted February 16, 2008 Author Share Posted February 16, 2008 But if I want the user to go to domainname/software and want the contents of the software folder to load how do I do this in the htaccess file? Do I add Directory Index software/index.php Because since the host updated to php5 when i go to domainname/software I get redirected now to my default 404 page, which is not what I want. If I want to load the contents of the software folder I now have to type in domainname/software/index.php I want to know if there is a shortcut I can place in the htaccess file so if a user does just go to domainname/software then it will load the contents because the htaccess file says something like " If user visits domainname/software* >> domainname/software/index.php Possible? Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-468150 Share on other sites More sharing options...
Stooney Posted February 16, 2008 Share Posted February 16, 2008 Directory Index index.php put it here domainname/software/.htaccess Now when someone goes to http://domainname/software they will be shown index.php At least that's how it should work. You should'nt even need this as it's usually default. Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-468205 Share on other sites More sharing options...
wildteen88 Posted February 16, 2008 Share Posted February 16, 2008 Directory Index index.php put it here domainname/software/.htaccess Directory Index needs to be one word: DirectoryIndex index.php However I would recommend you to have a word with your hosts about this though. Maybe they forgot to add index.php to the DirectoryIndex. Quote Link to comment https://forums.phpfreaks.com/topic/91028-htaccess-help-please/#findComment-468274 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.