Php – Apache is giving a 500 Internal server error on a sub domain created for the domain

.htaccessapache-2.2PHPsubdomain

I have created a subdomain by name http://admin.stenzsolutions.com and just to test the sub domain, i have hosted the same content as the main domain http://www.stenzsolutions.com

Now i have encountered a problem on the sub domain… The home page loads fine but if click any link, it gives me a 500 internal server error… The same content on the main works like a dream and there are no problems… here is the exact description of the problem that i have encountered…


Internal Server Error
---------------------

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache Server at admin.stenzsolutions.com Port 80

I just googled it and found that there might me a problem with my .htaccess file… So here is my .htaccess file


RewriteEngine On

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

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

And here is the exact error that i got from server error log


Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Best Answer

It sounds like you have absolute links in your code. Rather than stuff around with rewrites, which should not be necessary for such a case, you are far better off making your links relative. It really is bad practice to use absolutes for internal links, as you have now discovered, because it breaks portability and just creates a maintenance nightmare.

Edit:

It's best to check for problems in the resultant HTML, rather than the source code. Using Firefox or Chrome (and possibly every browser except IE) this is most easily done with the following "bookmarklet" (create a bookmark for any page and replace the URL with this code).

javascript:%20var%20win%20=%20window.open();%20win.document.write('<html><head><title>Generated%20HTML%20of%20%20'%20+%20location.href%20+%20'</title></head><pre>'%20+%20document.documentElement.innerHTML.replace(/&/g,%20'&amp;').replace(/</g,%20'&lt;')%20+%20'</pre></html>');%20win.document.close();%20void%200;