havide Posted October 31, 2014 Share Posted October 31, 2014 (edited) I have create a working site at localhost but when I upload it to webhost, it's not working, all link broken. This is the site. this is the directory : The index.php content is : <?php header('location:home.html'); ?> and the .htaccess content is : RewriteEngine on RewriteRule ^home.html$ main/home.php?main=home [L] RewriteRule ^penyakit.html$ main/home.php?main=penyakit [L] RewriteRule ^review-(.*)\.html$ main/home.php?main=detilgejala&id=$1 [L] RewriteRule ^solusi.html$ main/home.php?main=solusi [L] RewriteRule ^proses$ main/home.php?main=prosessolusi [L] RewriteRule ^bukutamu.html$ main/home.php?main=bukutamu [L] RewriteRule ^send-contact$ main/main_bukutamu/proses_bukutamu.php [L] RewriteRule ^about.html$ main/home.php?main=about [L] RewriteRule ^ensiklopedia.html$ main/home.php?main=ensiklopedia [L] Options All -indexes This config work in localhost. Thanks for your attention and respond, it help me so much and sorry for the topic's title can't edited it. Edited October 31, 2014 by havide Quote Link to comment https://forums.phpfreaks.com/topic/292192-help-with-htaccess-localhost-work-but-online-worst/ Share on other sites More sharing options...
Ch0cu3r Posted October 31, 2014 Share Posted October 31, 2014 Are you sure your website uses an Apache http server? Run phpinfo() to find out. If it is an Apache server have you made sure the .htaccess is being read? Best way to test this is to add random gibberish into the file. If the .htaccess file is being read then a 500 Internal Server error will be issued. Quote Link to comment https://forums.phpfreaks.com/topic/292192-help-with-htaccess-localhost-work-but-online-worst/#findComment-1495389 Share on other sites More sharing options...
havide Posted October 31, 2014 Author Share Posted October 31, 2014 Are you sure your website uses an Apache http server? Run phpinfo() to find out. If it is an Apache server have you made sure the .htaccess is being read? Best way to test this is to add random gibberish into the file. If the .htaccess file is being read then a 500 Internal Server error will be issued. this is the result, apache 2.0 handler. is't right? I think the .htaccess file worked and readed because if I put in my .htaccess code : DirectoryIndex main/home.php at first line, it work and my homepage showed, but not the other page because the "RewriteRule". Quote Link to comment https://forums.phpfreaks.com/topic/292192-help-with-htaccess-localhost-work-but-online-worst/#findComment-1495405 Share on other sites More sharing options...
havide Posted October 31, 2014 Author Share Posted October 31, 2014 I think its the apache server version or another thing in 000webhost not giving permission or not compatible to "RewriteRule" because when I change to hostinger with this phpinfo, all my .htaccess work here. Any Suggestion? btw, thanks Ch0cu3r for your respond, it help. Quote Link to comment https://forums.phpfreaks.com/topic/292192-help-with-htaccess-localhost-work-but-online-worst/#findComment-1495414 Share on other sites More sharing options...
Solution Ch0cu3r Posted November 1, 2014 Solution Share Posted November 1, 2014 Try adding RewriteBase / Before the first rewriteRule Quote Link to comment https://forums.phpfreaks.com/topic/292192-help-with-htaccess-localhost-work-but-online-worst/#findComment-1495461 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.