Help - Search - Members - Calendar
Full Version: htaccess question
Movable Type Community Forum > Additional Resources > Tips and Tricks
kacy
I need a little help with .htaccess.

I currently have a nifty little .htaccess file that makes the main index page of my site look like its at the site root:

CODE
DirectoryIndex ./mt/blog/index.html


This makes the main index of my site look like:
http://www.pastywhitegirl.com
instead of:
http://www.pastywhitegirl.com/mt/blog/index.html

I've got my indexes turned off, google blocked, and all that good stuff.  Now, my question:

I'd like to put another weblog in a subdirectory, lets say i'm going to put all my files at:
/mt/blog/blah/

can I use .htaccess to get the index page for the sub-weblog to look like:
http://www.pastywhitegirl.com/blah/
instead of:
http://www.pastywhitegirl.com/mt/blog/blah/

?

Do I add something to the .htaccess file in the root directory, or do I add a new .htaccess file to the /blah/ directory?

Any help is most appreciated!
girlie
It makes sense to me to create a new htaccess file in the blah directory.
kacy
Hmmm...  I added an .htaccess file with:
CODE
DirectoryIndex ./mt/blog/blah/index.html


to the /blah directory - I'm getting a 404 error.

Now I'm wondering if something in my main .htaccess file is preventing the second .htaccess file from working, or if I just have the syntax completely wrong.
girlie
Maybe try it without the .

DirectoryIndex /mt/blog/blah/index.html
kacy
nope, still not working...   huh.gif
girlie
Why not just publish your blog directly to the "blah" directory? I'm not sure I understand why you wouldn't.
oscarf
With:
./mt/blog/blah/index.html

in blah's .htaccess file,

the URL:

http://www.pastywhitegirl.com/blah/

is never going to traverse the path to blah to find it, you'll need to write a redirect in your root .htaccess file.
----

Oh, yeah, and what girlie said ...
kacy
I hadn't thought about just sticking everything in a blah directory up near the site root - I just assumed MT would only put files in a subdirectory to the mt directory.  I'm going to go try this.

Thank you both!
girlie
I still don't get it - there won't be any directories listed other than "blah" if you publish directly there. However, if you publish to "mt/blog/blah", then you will see all those directories listed in your archive links.

I do understand the desire to make something work when it isn't, I just think in this case, you're better off publishing straight to the directory in which you want the blog to appear.

Using htaccess makes good sense when you want to have your blog appear as your main page, but can't set permissions on your root directory to 777. That's not the case in your second scenario.
medic119
I have learned a lot about htaccess files lately.
One thing is that htaccess reads hierachially and applies all the rules from upper directories to lower.  Everytime you access a directory it looks up and down the chain for rules.

I use one htaccess file in my /public_html directory to handle most redirects, etc.  Works just fine.  Try adding

CODE
<Directory mt/blog/blah>
DirectoryIndex ./mt/blog/blah/index.html
</Directory>


or something similar to the original htaccess file.
oscarf
QUOTE
I do understand the desire to make something work when it isn't


This may be the kind of thing Dave Barry had in mind when he said, "there is a fine line between a hobby and mental illness" but I'm right there with ya ...

So, I couldn't get your way to work, Doc, though it seems like a good idea, and maybe I messed it up.

Here's what I would have done:

Create: /blah/
And Create: /mt/blog/blah/

Put an .htaccess file in /blah/ that says:
CODE
DirectoryIndex ../mt/blog/blah/index.html


Then publish your blog to /mt/blog/blah/

THAT will definitely get the job done (absurd as it is in a way).

So, who cares, now that girlie has enlightened you on MT's abilities?

While you're at it, of course, I would publish your regular blog right out to the root directory, to get rid of the redirecting altogether. That way, when a big host gobbles up your host and stops supporting your product, the port to a new server will be much more straightforward, and also, people's URL's will actually tell them where they are. Always nice.  smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.