0

I am trying to host a site for a first time and having problem while hosting the php MVC based site, 500 internal server error is shown.

While I tried before in localhost (using wampserver) the same error occured but I managed to solve it by uncommenting the 'LoadModule rewrite_module modules/mod_rewrite.so' statement in httpd.conf

But in cpanel there is no option to configure httpd.conf. I googled the problem but couldn't reach to the solution. Also I found out the httpd.conf is the global configuration and we don't have permission to access the file. So is there any way to solve 500 error through .htaccess configuration?

Options -MultiViews
RewriteEngine On

RewriteBase /mysitename.com

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
S. Tmg
  • 51
  • 7
  • Well, execute a php file with line `` and look for `rewrite`. If you don't find anything related to "mod-rewrite" then change host. – Forien Dec 29 '14 at 08:06
  • Check your Apache error.log to see what the error is – anubhava Dec 29 '14 at 08:08
  • So, you want to enable mod_rewrite. Therefore the question is 'can I load Apache modules through htaccess?'. No, you cannot. See http://stackoverflow.com/questions/16068097/can-you-load-an-apache-module-from-the-htaccess-file – JAL Dec 29 '14 at 08:08
  • You can ask your host to enable it. – JAL Dec 29 '14 at 08:08
  • Thank you everyone for immediate response. Like @Forien told me, I did search for the "mod-rewrite" and couldn't find it. Also the error.log is empty, nothing is being displayed. Yeah JAL that's exactly what I want to say – S. Tmg Dec 29 '14 at 08:23

1 Answers1

0

You may create a .htaccess file in the root of the application directory and add these directives inside it.

This works as a per-site settings. Whatever you put in httpd.conf is global.

sabkaraja
  • 342
  • 4
  • 15
  • Additionally check / add the default file is set to index.php DirectoryIndex index.php – sabkaraja Dec 29 '14 at 08:19
  • If you are getting errors inspite of this, part of the problem is elsehwere. Can you please post the error logs (apache / php) logs for reference. Couple of questions - why are you using RewriteBase /sitename.com? Its required if you are running your app inside a sub directory. This link should help [link]http://stackoverflow.com/questions/704102/how-does-rewritebase-work-in-htaccess Bottom line - we will need more information to provide an answer. – sabkaraja Dec 29 '14 at 09:00