Welcome to WebmasterWorld Guest from 54.227.101.214

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess

in subdirectories

     

universetoday

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

10+ Year Member



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

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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

10+ Year Member



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

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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



> 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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month