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

Apache Web Server Forum

    
Cannot access index.php in subfolder of Drupal
Please help a noobie out
quicksilver1024




msg:4491156
 7:48 am on Sep 4, 2012 (gmt 0)

I've given up. After a full day of trying to work this out, scouring the internet and applying every solution I findI still can't get this to work.

Drupal 6 is installed in root (with the Ubercart plugin), and I have a script I want to run in /subfolder1/subfolder2. The installation instructions for this script says that browsing to /subfolder2 without pointing to any specific file should start the web based installation. This does not work for me and neither does pointing to the index.php within the subfolder.

The error message I get is simply a page not found page that uses my Drupal theme.

I've tried everything on this page, including the comments: [drupal.org...]

No such luck. How do you access php files within a subdirectory under Drupal? Can someone please help me?

My .htaccess (in root):

ErrorDocument 401 /401.html
#
# Apache/PHP/Drupal settings:
#
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$ https://mywebsitename.com/cart/checkout/$1 [R,L]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$ https://mywebsitename.com/cart/checkout/$1 [R,L]
RewriteEngine On
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On

# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600

<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

### BOOST START ###
AddDefaultCharset utf-8
<FilesMatch "(\.html|\.html\.gz)$">
<IfModule mod_headers.c>
Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
</IfModule>
</FilesMatch>
<IfModule mod_mime.c>
AddCharset utf-8 .html
AddEncoding gzip .gz
</IfModule>
<FilesMatch "(\.html|\.html\.gz)$">
ForceType text/html
</FilesMatch>

# Gzip Cookie Test
RewriteRule boost-gzip-cookie-test\.html cache/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html]

# Caching for anonymous users
# Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
RewriteCond %{HTTPS} on
RewriteRule .* - [S=3]

# GZIP
RewriteCond %{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=1]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html]

# NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

### BOOST END ###


# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id$

 

g1smd




msg:4491182
 9:03 am on Sep 4, 2012 (gmt 0)

There's so many "I wouldn't do it like that" problems in that code, I don't even know where to begin listing them.

lucy24




msg:4491187
 9:13 am on Sep 4, 2012 (gmt 0)

Overlapping g1, who gave The Short Version ;)

You realize, I hope, that roughly three-quarters of that htaccess file is unnecessary. Some hosts are cagy about what Apache version they're running, and some humans really do still use 1.3, but, well, really... And I'm sure you can find out what php version you've got.

Where did they get that silliness about the favicon? If it doesn't exist it doesn't exist. On the remote chance that someone asks for it individually by name, no reason to handle it any differently from other requests.

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

They're making that up. It's just a soft 404 without the formality of a redirect. (Uhm, a mushy 404?) No "handling" involved.

The installation instructions for this script says that browsing to /subfolder2 without pointing to any specific file should start the web based installation. This does not work for me and neither does pointing to the index.php within the subfolder.

You left out one kinda crucial detail. Does /subfolder1/subfolder2 actually, physically exist?

quicksilver1024




msg:4491189
 9:28 am on Sep 4, 2012 (gmt 0)

Yes, /subfolder1/subfolder2 actually exists. What can I do to access the install script? :(

g1smd, I laughed. Yes I know. Even as a person who knows nothing about these I knew a lot of entries were either redundant or simply just unsecure. It's all going to go away with a new website that's coming up though. But, I'd like to just install this script to play with it before we push to the new site.

quicksilver1024




msg:4491257
 1:34 pm on Sep 4, 2012 (gmt 0)

My webhost fixed it for me! This is what was happening (his words):

"The issue was that permissions were set incorrectly, the files were uploaded as root and ownership needed to be set to the 'user_name' account, and the permissions set properly for SuPHP. This permissions error caused SuPHP to be unable to load the files as they were requested, and tried to spit out a server error page, however due to the Drupal redirects, the main drupal error was loaded instead."

So the fix: Reconfigure permissions and ownership.

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