Hey there,

My site is set up like this:
http://www.weeklydavespeak.com/news/
http://www.weeklydavespeak.com/media/
etc.

I moved from static PHP files to Drupal recently and decided to maintain these top level directories by creating a corresponding top level in my taxonomy.

I used pathauto to create aliases to the correct taxonomy terms for instance, news should point to .../taxonomy/term/2.

But for some reason my top level directories return 404 errors. The old index.php's have been removed. I tried erasing and re-creating the aliases but this doesn't help.

Previously, I used .htaccess to just point requests for /media and /news to the appropriate taxonomy term, but I know this is not the right way to do it.

Why are some of my aliases just not working? All of the sub categories seem to work and I can def. get to the aliased node's no problem.

Any ideas much appreciated.

rob

Comments

agentrickard’s picture

Looks like an Apache issue.

http://www.weeklydavespeak.com/index.php?q=news returns your page. This is a direct call to Drupal, bypassing .htaccess url rewrite rules.

I expected that removing the trailing slash from your URL would work:

http://www.weeklydavespeak.com/news

But your webserver bounces that request to:

http://www.weeklydavespeak.com/news/

Which 404s.

So perhaps mod_rewrite is stepping on Drupal's .htaccess rules (which govern url mapping)?

UPDATE

http://www.weeklydavespeak.com/?q=news/ works as well, so it looks like a CleanURLs problem. Check the Handbook for troubleshooting.

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.

jetsetter’s picture

Thanks for your reply.

I had a look at the troubleshooting suggestions in the handbook section on Clean URLs.

Then I realized that the problem appears to be that Drupal is returning a 404 because these physical directories exist. I have old public_html/news and .../media folders that still contain static php files from my pre-drupal days.

To test this, I created a directory public_html/user and tried navigating there. Drupal returned a 404. When I removed it again drupal did its correct search to see if I was logged in and display my user information.

So, my new question is--how can I get drupal to ignore that a directory exists and not freak out with a 404?

rob

agentrickard’s picture

You would need to make changes to .htaccess, but that wouldn't allow you to use the directory for some paths and not for others.

So you've found the cause, I just don't know if there is a solution other than moving the old files to new locations.

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.

wmclark’s picture

I have this same problem. At first, I thought my Clean URLs just weren't working.

agentrickard’s picture

The cause for this is that Drupal (like WordPress and some other PHP-based tools) is basically a lage 404 handler. If Apache cannot find a file reference, the error handling is passed to /index.php (Drupal) by the .htaccess file.

AFAIK, you cannot have directories that clash with Drupal paths on your web server. Apache (and other web servers) will always say "a file is present here" and never send the request to Drupal. (Even if that file is a non-existent index file.)

Three solutions:

- Move the offending directories.
- Use .htaccess or an index.php file in those directories to force /DIRNAME to load Drupal directly as /index.php?q=DIRNAME
- Run Drupal from a subdirectory (like /content). This is what The Onion does. http://www.theonion.com/content/.

Option #3 may be your best bet. Then just direct requests for http://example.com to http://example.com/content.

--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.

jetsetter’s picture

Hello,

Unfortunatly, I'm not in a place where I can move all that old content. I suppose I should have installed drupal in a seperate directory in the first place. That would have been a good move.

Anyhow, my solution was to re-write the dir's I needed thus:

RewriteRule ^media/$ taxonomy/term/21
RewriteRule ^news/$ taxonomy/term/2

That did it.

Thanks.

rob