User login

Using directory-reserved paths in Drupal

Searched words: 
drupal how to have path same name as directory drupal alias directory access denied 403 Forbidden You don't have permission to access /modules/ on this server. drupal path alias Forbidden You don't have permission to access on this server use drupal pages instead of forbidden directories

[There is no current general resolution to using directory-reserved paths, but it's surely possible with custom Apache rewrite rules-- apparently everyone concludes (as i am right now) that it's not worth the effort!]

Partial Resolution

To .htaccess, add:

    # Allow the modules path to be used by Drupal for the modules chapter.
    RewriteCond %{REQUEST_URI} ^/modules/?$
    RewriteRule ^ index.php [L]

Description of Problem / History of Search for Solution

is there any way around not being able to have a path alias of, say, 'modules' because Apache doesn't want to let anyone look in the /modules/ directory?

[fellow Drupalista on IRC]: mlncn: i ran into that problem with /sites/ the other day, but i didnt bother working on it, just worked around it :\
12:32 mlncn: yeah, i cannot believe i'm not finding anyone even asking about it in my searches. I do know i've relied on this behavior to allow static sites to live within a Drupal directory. They'll take precedence
12:33 mlncn: but... a path named 'sites' or 'themes' not possible? that's just not cool.

12:40 mlncn: stefan-agaric: how much of a headache would it be special-casing an apache rule/redirect to allow /modules on dgd7.org to go to the modules chapter rather than the 403 forbidden directory? Should i just use tamft as the alias instead?

13:03 stefan-agaric: mlncn, what is the redirect you would like to enable?
13:04 mlncn: stefan-agaric: I'd like http://definitivedrupal.org/modules to go to http://definitivedrupal.org/node/58 (but still be aliased...)
13:05 stefan-agaric: ??
13:05 stefan-agaric: modules as path alais for node/58?
13:06 stefan-agaric: no, you want to remove the path alias?
13:06 mlncn: stefan-agaric: go to the first link and tell me what you see :-)
13:07 stefan-agaric: you get a 403 from Apache.
13:08 mlncn: And that is the problem i'm trying to work around. As i'm finding nothing in searches, i don't imagine there's an easy way to get /modules to act like a normal path alias. But i don't see anyone even posing the question!

13:09 stefan-agaric: well, module is in the reg exp of the .htaccess
13:09 stefan-agaric: that's one of the disadvantages of having the code in the docroot.
13:09 mlncn: stefan-agaric: .module is, but not the modules directory?
13:09 mlncn: stefan-agaric: it is indeed
13:10 stefan-agaric: but you are right, it must be unrelated.
13:11 stefan-agaric: I can check on simone
13:12 mlncn: stefan-agaric: ok, let's not spend any time on this until a client insists that something be at path /sites or something. But i'm amazed i'm not finding people writing about running into this.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.