Forum Moderators: phranque

Message Too Old, No Replies

htaccess and redirect.

I'm close, but not quite there.

         

ken_b

9:05 pm on Feb 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I want to redirect mysite.com to www.mysite.com/

Thanks to help found here at WW this is what I've installed:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^(.*)$ [mysite.com...] [R=permanent,L]

Works fine, but redirects to www.mysite.com/index.htm

If I just type in mysite.com I get www.mysite.com/index.htm

If I type in www.mysite.com I get www.mysite.com/

So what am I missing? How do I get the rdirect to drop the index.htm, or can I?

[Can you tell I'm new to htaccess? And why is it that the more I learn, the less I seem to know?]

too much information

9:10 pm on Feb 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey ken,

I was just searching for this same thing this morning. Try this thread:

[webmasterworld.com...]

It seemed to start at your same point and work forward.

good luck

ken_b

12:51 am on Mar 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks TMI; I checked out that thread, and didn't see my question answered there, or didn't understand it if it was.

Meanwhile, Ive come across another question.

The code I posted above has [R=permanent,L] in it.

I see other people suggesting [R=301,L]

I wonder what the difference is, or if one is better than the other?

jdMorgan

1:45 am on Mar 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ken,

1) Your code is fine. Exactly right, in fact.
2) [R=permanent] and [R=301] are equivalent. [R=301] is "better" only in that it takes fewer characters to type.
3) The bad news: Some other code or configuration setting on your site is causing the problem. The code you posted is not the cause. If you have no other .htaccess code or scripts that could do this, then you'll need to ask your host about this problem.

Jim

ken_b

2:07 am on Mar 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks Jim;

The only other thing in my htaccess is a line to generate a 404 page.

ErrorDocument 404 /page_not_found.htm

Which seems to work fine, but that doesn't mean it's right :)

"Ask...host" Yeahhhhh.... that aint as easy as it sounds. Mega-monster-cheapo-deluxe host support seems to kmow less than I do. But I can always give it a shot :)

The reason I want the index.htm dropped is to achieve conformity with my links. I suppose when I change them from relative to absolute I could make the include the index.htm.

Not my first choice, but maybe it'd work.

Thanks again.

jdMorgan

2:27 am on Mar 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cheap hosting is expensive.

Jim