Jump to content

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/246763-mvc-htaccess-problem/
Share on other sites

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.

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.

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?

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.