1

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.
5
  • Try adding RewriteBase / just after RewriteEngine on
    – Yazmat
    Sep 11, 2012 at 12:26
  • Its the same...
    – Abilash
    Sep 11, 2012 at 12:30
  • Not really a question about programming - voting to move to serverfault.
    – Konerak
    Sep 11, 2012 at 12:30
  • please guys... tel me something about this...
    – Abilash
    Sep 11, 2012 at 12:36
  • What's an example URL that is causing this to happen?
    – Jon Lin
    Sep 11, 2012 at 15:02

2 Answers 2

1

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;
4
  • I haven't used any absolute links in my code... It's Model View Controller implementation... In fact you can't even discover which file is being rendered...
    – Abilash
    Sep 16, 2012 at 4:23
  • @Abilash, maybe you should examine the resultant HTML. One of the things I really hate about MVC is that you have little idea of just what the resulting code will be. You may not have used absolute links but without looking you cannot know whether or not your MVC implementations has done so. Sep 16, 2012 at 10:47
  • I have the same content as in the main site, that is www.stenzsolutions.com. That works well, but when i host it on a sub-domain, it's failing... With this can I confirm that its not a problem with my HTML?
    – Abilash
    Sep 17, 2012 at 4:45
  • @Abilash, That most certainly does not confirm your HTML is ok, in fact it indicates the opposite. See the edit to my answer. Sep 17, 2012 at 10:53
0

.+ also match index.php. It is the reason for infinite loop. Some ways to fix this:

  1. RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_URI} !^/index\.php
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
    
  2. RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-l
    
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] 
    RewriteCond %{ENV:REDIRECT_STATUS} 200 
    RewriteRule .* - [L]
    
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .