RyanMinor Posted September 9, 2011 Share Posted September 9, 2011 My dillemma is this: I have a test website that is an MVC framework I built. The test site is in a subdomain on a GoDaddy shared hosting account. The address to the test site is test.website.com and the root folder for the test site is /root/test. I had a .htaccess file to route all reqests in it but was getting 500 Internal Server Errors. When I removed the .htaccess file the home page worked but no links did. I got 404 Errors for them. I guess I need to modify my .htaccess file to get everything to work. Here is my current one" php_flag display_errors on php_value error_reporting 9999 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] I admit I am not very good with mod_rewrite, regex, or .htaccess so any help is greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 9, 2011 Share Posted September 9, 2011 getting 500 Internal Server Errors You can only put php settings in a .htaccess file when php is running as an Apache server module. It's highly likely that php is running as a CGI application on your hosting and the php settings in the .htaccess file are what are causing the 500 Internal server error. Quote Link to comment https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/#findComment-1267235 Share on other sites More sharing options...
cags Posted September 9, 2011 Share Posted September 9, 2011 Juist to offer some alternatives (assuming your are using mod_php)... The mod_rewrite modules is not enabled. You can test if that's the problem by removing the Rewrite stuff and leaving in the php settings (obviously you can do vice versa to test PFMaBiSmAd's theory). Perhaps index.php isn't matching a file which is causing an infinite loop. Depending on your folder structure this could be down to your RewriteBase. You could easily test that by changing index.php to http://www.google.com/ and seeing if you end up on google or still get the error. Quote Link to comment https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/#findComment-1267256 Share on other sites More sharing options...
RyanMinor Posted September 9, 2011 Author Share Posted September 9, 2011 I should mention that even without the PHP values at the top of the .htaccess file, my page gave me the 500 Internal Server Error. Quote Link to comment https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/#findComment-1267377 Share on other sites More sharing options...
RyanMinor Posted September 10, 2011 Author Share Posted September 10, 2011 Juist to offer some alternatives (assuming your are using mod_php)... The mod_rewrite modules is not enabled. You can test if that's the problem by removing the Rewrite stuff and leaving in the php settings (obviously you can do vice versa to test PFMaBiSmAd's theory). Perhaps index.php isn't matching a file which is causing an infinite loop. Depending on your folder structure this could be down to your RewriteBase. You could easily test that by changing index.php to http://www.google.com/ and seeing if you end up on google or still get the error. When I put the http://www.google.com instead of index.php it went to Googles website. Does this mean I will need to put website/subdomain/index.php instead of index.php in my .htaccess since my files are contained in a folder within the site root? Quote Link to comment https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/#findComment-1267580 Share on other sites More sharing options...
cags Posted September 10, 2011 Share Posted September 10, 2011 In honesty it's been quite awhile since I've used a .htaccess folder in any directory other than the document root, so I couldn't say for sure, it's almost certainly a redirect loop that's occuring, you justt need to play around with the values and see what happens. You can turn on RewriteLog, this should give you an indication of what's occurring. Quote Link to comment https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/#findComment-1267588 Share on other sites More sharing options...
RyanMinor Posted September 12, 2011 Author Share Posted September 12, 2011 In honesty it's been quite awhile since I've used a .htaccess folder in any directory other than the document root, so I couldn't say for sure, it's almost certainly a redirect loop that's occuring, you justt need to play around with the values and see what happens. You can turn on RewriteLog, this should give you an indication of what's occurring. Thanks, I will try that. Like I said, my knowledge of this subject is about nil so I will do my best. Quote Link to comment https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/#findComment-1268414 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.