I have a controlpanel similar to cpanel that i access through 'www.example.com/ControlPanel'. After drupal is installed I get 'page not found'(drupal created page) on the sites(vhost environment) using drupal. I looked into the problem and found what should have been my answer at http://drupal.org/node/30334 , however i ran into some errors. This is what my .htaccess currently looks like:
...
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteOptions MaxRedirects=15
# If your site can be accessed both with and without the prefix www.
# you can use one of the following settings to force user to use only one option:
#
# If you want the site to be accessed WITH the www. only, adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
# RewriteRule .* http://www.example.com/ [L,R=301]
#
# If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
# RewriteRule .* http://example.com/ [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /
# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
# Do Not Rewrite directories used by web apps
# Instance: ControlPanel
RewriteCond %{REQUEST_URI} '/ControlPanel/'
# Addtional entries should be followed by [OR] except last entry
RewriteRule (.*) $1 [L]
# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
# $Id: .htaccess,v 1.73 2006/04/14 09:08:26 killes Exp $
'ControlPanel' is configured for use throughout all vhosts in httpd.conf like this:
## <===CPX:CPX start===>
## User changes (other than commenting out lines within this block)
## should be placed before or after this block. Any user changes made
## within this block may be lost when CPX is removed or upgraded.
<IfModule mod_perl.c>
## begin cpx section
## this set of directives is automatically managed by the cpx vinstall.
## If you break this seal, your warranty is void.
Alias /cpimages /usr/local/cp/images
Alias /ControlPanelHelp /usr/local/cp/help/
<Location /ControlPanel>
SetHandler perl-script
PerlHandler ControlPanel
</Location>
## end cpx section
</IfModule>
## <===CPX:CPX end===>
When first trying to implement what is said at http://drupal.org/node/30334 i still receive 'page not found'.
I then changed the single quotes to double quotes and receive an Internal Server Error when accessing 'www.example.com/ControlPanel/' but receive 'page not found' when accessing 'www.example.com/ControlPanel'
The error log shows the following: (note: i took out the date and ip address)
[DATE] [error] [client 0.0.0.0] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
I then tried what the error suggested... 'RewriteOptions MaxRedirects=40' but this resulted in:
[DATE] [error] [client 0.0.0.0] Request exceeded the limit of 20 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
Then i change the number to 15 and receive:
[DATE] [error] [client 0.0.0.0] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
This should have been plenty considering the default is 10 and i only added two lines for a total of one rewrite. I did not try 'LimitInternalRecursion' because there should be no need to do so as i see it.
Then i commented out 'RewriteOptions MaxRedirects=15' as shown above. which as one would guess results in the first error shown above.
Thank you for your interest!
Comments
After some research...
After some research about mod_rewrite and a quick bushup on regex, i have got it to semi-work. 'www.example.com/ControlPanel' produces the controlpanel page, however 'www.example.com/ControlPanel/' (note the '/' at the end) give me a internal server error the same as above, but here it is again for display purposes. (again note: i took out the date and ip address)
[DATE] [error] [client 0.0.0.0] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
These are the new code lines that seem to semi-work.
I believe i have to work on the regular expression to make this work. The controlpanel frontpage shows up but it is not usuable after that because this expression only handles the '/ControlPanel' part and not anything after that.
Thus far...
This never was a drupal problem, however it concerns drupal because many run similar tool options as i am doing. Therefore, i'm going to continue posting here. So i have fixed my regex statements further...
I will read off what this means for those of you that are regex illiterate. The start of the the string should literally read '/ControlPanel' then may be followed with zero or one '/' or '/' with one or more characters that conclude the string. I believe these statements to be true.
What is happening is that mod_rewrite is going into a restricted(our internalrecursion is set to 10 by default) infine loop. I know this from viewing the rewrite log...
This log file is quite large.
Could i get alittle help here?
I would try this: Remove
I would try this:
Remove this part
and instead add on line to the Drupal rewrite part like this
Solution...
I had tried something similar a few hours ago, only i didn't remove my previous directives. I slightly changed the above because it is imparative for the string to be case sensitive(the [NC] denotes case insensitive), because if it is not case sensitive, perl or apache, won't pick it up the same way. So the code now reads:
Special THANKS to frjo for replying!
Someone should probably work on removing http://drupal.org/node/30334, because everything this lead to was incorrect. This was also at the top of my search results when trying to solve this on drupal.org.