Welcome to WebmasterWorld Guest from 54.147.63.124

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess

in subdirectories

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

Full Member

10+ Year Member

joined:May 21, 2003
posts:333
votes: 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.

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

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 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

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

Full Member

10+ Year Member

joined:May 21, 2003
posts:333
votes: 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.

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

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 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

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members