After installing Drupal 5.1 in the root of public_html, I tried to install Invision File Manager (in /ifm) and other file manager scripts in the root also. It seems that Drupal "catches" the request www.mysite.com/ifm and says: "Page Not Found".

Why? Anyone has a solution?

Comments

cog.rusty’s picture

There are many solutions, depending on what you want to do. This is caused by Drupal's htaccess file.

The relevant lines are (a) the last block of lines which are responsible for "clean URLs", (b) the DirectoryIndex line and (c) sometimes the Options -Indexes line, depending on the problem. Problems can be solved either by modifying Drupal's .htaccess file or by adding a new .htaccess file in the subdirectory to override some settings.

But to be more specific I need to know what IFM is. Is it a PHP application? Does it have an index.php file or what?

hakeem’s picture

Yes, it is a PHP web file manager (Invision Filemanager) and has index.php.

--
www.hakeem-sy.com

cog.rusty’s picture

Edited to add: The following is only relevant if you have Drupal installed directly in your web root and not in a directory. If Drupal is in a directory, it is just not possible to affect another parallel directory. If they are parallel directories, Drupal has nothing to do with it and you just need an .htaccess file in /ifm containing a DirectoryIndex index.php line.

If Drupal is directly installed in your web root, the following applies.

----------------

Check the .htaccess file which is in your public_html. If Drupal itself works, then the DirectoryIndex line is OK and the culprit is probably that last block of lines:

# 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]

Do you have these lines? The two RewriteCond lines tell Drupal not to interfere if it is a real file or a real directory. There is a caveat though. If it is a real directory but does not contain an index file as specified in the DirecoryIndex line, then this directive is ignored and Drupal does interfere.

You can make it bulletproof by disabling those two lines with a # and putting this in their place:

RewriteCond %{REQUEST_FILENAME} !-U

This should work, except if there is some other modification in your public_html/.htaccess file.

clockbroke’s picture

I just poted this and it didn't seem to show? Here it is again, my apologies if it's a dupe.

Back up your .htaccess file for safety, and add this line:
RewriteRule ^DIRECTORY$ http://www.example.com/DIRECTORY/INDEX_FILE [R=301,L]

Replace DIRECTORY with ifm, and INDEX_FILE with the file you're requesting to launch this application (index.php, or perhaps index.htm, etc...).

this will rewrite requests for www.example.com/ifm as www.example.com/ifm/index.php

good luck.

clockbroke’s picture

Add a line in your .htaccess file (make a backup copy first!)

RewriteRule ^DIRECTORY$ http://www.mysite.com/DIRECTORY/INDEX_FILE [R=301,L]

so yours would be:
RewriteRule ^ifm$ http://www.mysite.com/ifm/INDEX_FILE [R=301,L]

And replace INDEX_FILE with index.php, or index.htm, or what ever file needs to open when www.mysite.com/ifm is requested.

I had tried other .htacces redirect tricks with some success and some disaster, but this one has been flawless.

fidot’s picture

fidot’s picture