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

Apache Web Server Forum

    
.htaccess
in subdirectories
universetoday




msg:3012051
 7:19 pm on Jul 17, 2006 (gmt 0)

I've switched my site from HTML based to a Wordpress content management system, and I'm trying get all the old pages to forward nicely to the new pages. I can get the .htaccess redirect to work from the root directory, but not from the subdirectory where the HTML files are located. I figure I don't want to bloat up my root .htaccess, it'll just slow the site down.

Any commands I put into the subdirectory .htaccess are just ignored, like the file doesn't even exist.

Is there a setting I can set? I find mucking with the .htaccess to be very dangerous. I often take my entire server offline with a simple typo.

 

jdMorgan




msg:3012311
 10:52 pm on Jul 17, 2006 (gmt 0)

Please post an example of the code you tried in your top-level directory, and the code you tried in the subdirectory. It's a bit hard to diagnose the patient if we can look at it...

Jim

universetoday




msg:3012329
 11:00 pm on Jul 17, 2006 (gmt 0)

Ahah, I figured it out. I need to have the full path to the URL regardless of its directory location.

For example:

/.htaccess
Redirect /full/path/file.html [site.com...]
... works

/full/path/.htaccess
Redirect file.html [site.com...]
... doesn't

You need to have this, regardless of the location of the .htaccess file.
Redirect /full/path/file.html [site.com...]

Will Apache only load this .htaccess file if it tries to access the directory? I'll eventually have a few thousand redirects in here, so I don't want my server trying to load this file every time it loads a file off the entire webserver.

jdMorgan




msg:3012352
 11:21 pm on Jul 17, 2006 (gmt 0)

> Will Apache only load this .htaccess file if it tries to access the directory?

Yes, only .htaccess files in the path to the requested resource are processed.

Jim

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