Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

migrated from stackoverflow.com Sep 12 '12 at 7:18

This question came from our site for professional and enthusiast programmers.

2 Answers

.+ 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]
    
share|improve this answer
    
Nope... its not working :-( Any other solutions? please use testing.stenzsolutions.com to see whats happening.. –  Abilash Sep 16 '12 at 4:21
add comment

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;
share|improve this answer
    
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 '12 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. –  John Gardeniers Sep 16 '12 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 '12 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. –  John Gardeniers Sep 17 '12 at 10:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.