Is there an easy way to do this - if not, is this something useful to submit as a feature request?

I would like to keep the top level html folder of my site as clutter free as possible.

If I install all the drupal files at the top level, I get all these files:

.htaccess    CHANGELOG.txt    cron.php    database    favicon.ico    files    includes    index.php    INSTALL.txt
LICENSE.txt    MAINTAINERS.txt    misc    modules    scripts    sites    themes    update.php    xmlrpc.php

I would like to keep only the minimum set (.htaccess and index.php?) in the top folder, and move all other files into a /drupal/ folder.

So, any user navigating to my top level domain will still get all the drupal delivery - without having to do any Meta-tag redirects, or .htaccess redirects, or client-side Javascript redirects from the top folder into /drupal/

Is this easily doable?

Comments

anders.fajerson’s picture

Textpattern (a blogging tool) has this "feature" and it's just feels better. Clean. Tidy.

And my preferd setup would be:

files
drupal
.htaccess
index.php

matthew’s picture

You can delete all of the .txt files. You can safely move cron.php and update.php to wherever you want, as these as files that you will call manually (or with a cron script).

Best,

Matthew

kbahey’s picture

I agree with this feature request. I was thinking of this myself a while back, when I was about to test my upgrade, and had to merge files, ...etc.

This will simplify upgrades and other things. It isolates Drupal in its own directory, so other stuff can exist in their own directories. All data files, image files, and other things have to be outside drupal. Only additional modules, themes and settings.php files should go under the Drupal directory. As a matter of fact, even local modules and local themes, and even the sites directory can be located in its own directory

For example:

public_html
- .htaccess
- index.php
- drupal/
- drupal-local/

Under drupal-local we have:
- drupal-local/sites/
- drupal-local/sites/site1.com/settings.php
- drupal-local/sites/site1.com/themes/
- drupal-local/sites/site1.com/modules/
- drupal-local/sites/site2.com/settings.php
- drupal-local/sites/site2.com/themes/
- drupal-local/sites/site2.com/modules/
- drupal-local/themes (themes shared by all sites)
- drupal-local/modules (modules available to all sites)

Drupal can search for drupal-local/ first for configuration files, then search drupal/modules and drupal/themes for modules and themes, then search drupal-local for modules and themes.

The "drupal" directory should contain the standard Drupal distribution with no modifications whatsover, with instructions to move or copy the .htaccess and index.php to the directory above, so local changes can be merged on upgrades manually.

This way, upgrades will be much easier: everyone should leave the drupal/ directory alone, and only mess with the drupal-local directory.

Please submit it as an issue for Drupal core as the project, and post its url here.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

Mahatma’s picture

... nothing except a new index.html (or .php) in root folder? This would be easier than dislocating your Drupal index file.

Then you can have anything you want in the new index file in your root folder and your drupal index file in with Drupal files in subdirectory. You can have it redirect, show a splash menu, select between several choices ...

IMHO

kbahey’s picture

That would work if people come to your main page of the site only, but not other pages.

For example, if people would go to example.com or example.com/index.html, then it would correctly redirect to your Drupal installation.

However, if they go to example.com/node/123 or example.com/aliased-node then they would get a 404.

Having this as a feature in Drupal will serve two purposes:

- Admins would have a more manageable directory hierarchy
- Upgrades would be much simpler if we separate core drupal from contributed modules, themes and local configuration files.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

Mahatma’s picture

... why do you say they will get a 404? of course i meant to install Drupal in the subdirectory, and just alias the urls or redirect. I have installed in sub-dir all files and no missing files/pages at all. Drupal knows it's in sub-dir, but you can alias any directory or redirect to any. . .

if you alias dirs no one will know ... I think

kbahey’s picture

I mean it cannot be used for an existing installation without incurring 404. Someone who has now Drupal installed in the root directory, will have to do a lot of redirection magic or deal with 404s if they move Drupal to a subdirectory.

If they install it from the start in a subdirectory it is not such a big issue.

However, I do like the simpler URLs where there is no subdirectory involved. That is a matter of personal taste though.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

Mahatma’s picture

... all you have to do is make a new install of blank Drupal in new directory and switch databases to old db. Works fast and easy to change directories. I've done it, to see how it works. Took 5 minutes.

But you must make a fresh install in new directory, with new database blank, then go into config and change databases, and poof all done.

Then you must change urls inside of forum posts and etc that point to old directory, of course, and update all links ... or just redirect all traffic from old dir to new dir, maybe use the alias directive... can't you use that in htaccess? I'll check. I know you could do something like that. If anyone gets stuck and needs redirect info contact me we'll figure it out.

kbahey’s picture

Switching Drupal is technically very easy on the install level.

Bu the point is: you will break internal and external links.

Say you have a site with a few hundred articles, many of those articles contain links to other articles. Search engines also indexed your content, and these will no longer be valid.

Is it clearer now?
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

Mahatma’s picture

So is your server the apache server? I see you mentioned not wanting to do any metatags redirects , and I'm not sure what you don't want, but the best idea that popped into my head was using the apache server alias command to do a 'redirect' and/or use htaccess rewrite engine.

EG- setting up an alias in apache means giving a name to a directory and then apache automatically refers to this directory by this name without using the entire path/url. For instance /mysite/thisdir/thatdir/cgi-bin can be given an alias of 'cgi-bin' and no need to use long path to refer to it any longer. Any reference to 'cgi-bin' would automatically go to /mysite/thisdir/thatdir/cgi-bin. That doesn't seem like it meets your need.

A url rewrite would, or could, receive a url request for /home/index.php and be re-written on the fly to actually be /home/subdir/index.php without the user ever knowing. If you do it right, a rewrite could simply re-write any request for any url with an added directory inserted into the url. So that would do what you want, because no matter what was requested, a page or whatever, it would be re-written to the current url of the item, if it was now in a different subdir AND the rewrite inserted the subdir into the url as it came in.

This is not easy to design the rewrite unless you are very familiar with the rewrite rules. It puts a load on the server. It would however prevent any broken links in a url request by re-writing it to a correct url on-the-fly.

Anyone else who knows more of this feel free to jump in! :) So that was what i meant, and changing the dir is only easy technical, and doing a rewrite is a little harder, I think.

That's what I was trying to say.

IMHO

kbahey’s picture

I went ahead and opened a feature request for this.

Comments on this can proceed there now.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

jerryblogger’s picture

For example:

public_html
- .htaccess
- index.php
- drupal/
- drupal-local/

Under drupal-local we have:
- drupal-local/sites/
- drupal-local/sites/site1.com/settings.php
- drupal-local/sites/site1.com/themes/
- drupal-local/sites/site1.com/modules/
- drupal-local/sites/site2.com/settings.php
- drupal-local/sites/site2.com/themes/
- drupal-local/sites/site2.com/modules/
- drupal-local/themes (themes shared by all sites)
- drupal-local/modules (modules available to all sites)
______
that's just what I want! I planned to do manually............