homepage Welcome to WebmasterWorld Guest from 54.211.97.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Internal Server error for pages except home page
Muhammedanees



 
Msg#: 4569887 posted 5:15 am on May 2, 2013 (gmt 0)

Hi,
My folder structure for the project has been changed to increase the security into the following

httpdocs
-->application
-->public
---->index.php
---->.htaccess
---->styles
-->library
-->core

from
httpdocs
-->application
-->public
---->styles
-->library
-->core
-->index.php
-->.htaccess

and changed the Document root parameter from /httpdocs to /httpdocs/public from the Plesk panel

After this change the site become too slow, and while checking the logs we have found the error as

"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. "

checked for the solutions in the web and found this post
[stackoverflow.com...]

and after setting the rewrite base in the .htaccess file
as
RewriteBase /var/www/httpdocs/
it starts loading fast, without any delay.
But, only home page is loading from that moment
all other pages gives "Internal server error"

Can anyone suggest me a method to resolve this

Thank and Regards,
Anees

 

Dideved



 
Msg#: 4569887 posted 7:03 am on May 2, 2013 (gmt 0)

Your rewrite rules from SO are not how I would write them, but nevertheless, when I plugged your server config and htaccess into my local server, everything ran fine; no loops. So I have to think that there's some other factor at work that we haven't seen.

Muhammedanees



 
Msg#: 4569887 posted 7:53 am on May 2, 2013 (gmt 0)

I just rewrote the htaccess entries from

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php

to

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


and it works fine now,

But couldn't understand what was the difference

Can anyone please tell me what changes it made

Regards
Anees

Dideved



 
Msg#: 4569887 posted 3:58 pm on May 2, 2013 (gmt 0)

Heh, well... that htaccess doesn't look anything like what you had us looking at on SO. In any case, I plugged both htaccess versions that you just posted into my local server, and both worked correctly. So I still have to think that there's some other factor at work that we haven't seen.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4569887 posted 8:53 pm on May 2, 2013 (gmt 0)

But couldn't understand what was the difference

There are two huge differences.

#1 The first quoted RewriteRule doesn't have the [L] flag. If this is an accurate quote, not just a typo in the post, it explains much.

#2 Change from
RewriteRule .* index.php
vs.
RewriteRule ^index\.php$ - [L]
<snip>
RewriteRule . /index.php [L]

At first glance this has no effect at all EXCEPT that it runs much more efficiently, because if the request is for "index.php" the server does not have to stop and check whether the file exists. Note that in your quoted rule-- unlike the linked post you referenced-- both versions of the rule have the !-f and !-d conditions, so this isn't relevant. Without the conditions you would of course have an infinite loop if you didn't exclude requests for index.php

The really significant change is in the target. Old version has no leading slash; new version has leading slash.

RewriteBase /var/www/httpdocs/
The RewriteBase is only applied if the target does not begin with a directory slash. (The formal explanation is longer and more complicated; for practical purposes "begins with a slash" is enough.) So the target of the new rule is the URL /index.php while the target of the old rule was the path /var/www/httpdocs/index.php


Another day, we'll talk about that !-f and !-d set of conditions. At an absolute minimum, the body of the rule should be constrained to requests ending in / or a page extension (php or html or whatever you use). Requests for images, stylesheets and similar supporting files should never go near the rule in the first place. If you put this into the body of the rule, the server does not have to waste time evaluating conditions. And if someone does request a nonexistent image, the rule is still pointless because their browser is not going to display a page instead. Your server will send it, but the browser generally won't display it.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4569887 posted 7:21 am on May 3, 2013 (gmt 0)

welcome to WebmasterWorld, Anees!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved