Modifying .htaccess

Modifying .htaccess

Posted by: jbbryant
Posted on: 2008-07-03 07:00:00

I already posted this with a different subject line, but I don't think it was a good one (didn't get responses) so I'll try again.

A WordPress plugin I use only works if the index page's filename is part of the URL.

So, when someone enters my blog's URL as:
http://www.jbryant.org/library

I need it to resolve to:
http://www.jbryant.org/library/index.php

DreamHost support tells me that I need to do this through an .htaccess modification, but beyond that they aren't able to help.

I have modified .htaccess before and generally know how to edit it, but I need someone to tell me explicitly what I need to add. This is not my area of expertise. I've searched the Web for the solution, but to be honest I get lost when I read through all the possibilties. If someone can tell me just what I need to add or change, though, I can do it.

Can you help?

Re: Modifying .htaccess

Posted by: silkrooster
Posted on: 2008-07-03 17:03:00

Try this:
redirect perminate http://www.jbryant.org/library http://www.jbryant.org/library/index.php



My website

Re: Modifying .htaccess

Posted by: silkrooster
Posted on: 2008-07-03 17:07:00

Sorry typo should be permanent
You can also use the code which I beleive is 301.

My website

Re: Modifying .htaccess

Posted by: sXi
Posted on: 2008-07-03 19:27:00

Yeah 301 redirects are awesome.. especially if you're concerned with moving pages or sites while retaining search engine ranks.


Re: Modifying .htaccess

Posted by: jbbryant
Posted on: 2008-07-06 03:09:00

Silkrooster:

Thanks for the reply. I added the following line to the .htaccess file that is at the top level of my blog's directory structure:
redirect permanent http://www.jbryant.org/library http://www.jbryant.org/library/index.php

I added that line as the second line, right below the line that reads "# BEGIN WordPress"

It didn't have any effect.

I'm not sue what you mean by "using the code"

Further help would be greatly appreciated.

Re: Modifying .htaccess

Posted by: Atropos7
Posted on: 2008-07-06 03:40:00

RedirectMatch ^/library/$ http://www.jbryant.org/library/index.php

As for the status codes, see the documentation

If the url-path /library/ exists as a directory on the file system, "http://domain/library" becomes "http://domain/library/"

And naturally if you read the entry for "Redirect" you'll notice the url-path in the directive is matched against the beginning of the url - thus you have to use RedirectMatch to indicate you are trying to match a url that begins and ends as /library/


cool openvein.org -//-

Re: Modifying .htaccess

Posted by: jbbryant
Posted on: 2008-07-06 04:02:00

Atropos7:

Bingo! You got it. It now works, and what's more, I understand how it works.

Thanks you!

Thanks also to silkrooster and sXi for all your help.

jb

Tags: index pagesubject linewordpress pluginblog