Forum Moderators: phranque

Message Too Old, No Replies

301 index.php, index.htm and index.html

Can you point me to the thread?

         

Marls

7:13 pm on Dec 12, 2005 (gmt 0)

10+ Year Member



Hi There,

No doubt this has been answered numerous times before -- so if you would just point me to the thread I'd really be greatful.

Have tried numerous things, including the code below, to no avail.

RewriteCond %{REQUEST_URL}!^/index\.php$
RewriteRule ^$ http://www.example.com/$1 [R=301,L]

Thanks!

skinter

9:56 pm on Dec 12, 2005 (gmt 0)

10+ Year Member



Wait, what exactly do you want this to do?

Marls

3:12 am on Dec 13, 2005 (gmt 0)

10+ Year Member



Hi!

Thanks so much for getting back to me. I've searched every place and can't seem to find the answser to this:

Due to hijackers I need to 301 www.mysite.com/index.php, www.mysite.com/index.htm and www.mysite.com/index.html to www.mysite.com/

Also is it possible to do a 301 for www.mysite.com.htm to www.mysite.com/

I REALLY appreciate any assistance on this.

jdMorgan

3:58 am on Dec 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See [webmasterworld.com...]

Jim

Marls

4:23 pm on Dec 13, 2005 (gmt 0)

10+ Year Member



Although it's saying nothing new, how this can within seconds turn days of frustration into awe – is magical! And Jim, again, I can't thank you enough.

As to my second question: Given that the code works so wonderfully, am I correct in assuming that the following will 301 www.example.com.htm to www.example.com/

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*com\.htm\ HTTP/
RewriteRule ^(.*)index\.html$ http://www.example.com/$1 [R=301,L]

Best,
Marls

jdMorgan

4:59 pm on Dec 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think it will be possible to rectify this problem at your server. The reason is that requests for www.example.com.htm are invalid. This is a request for a top-level domain of ".htm" as opposed to ".com" or ".uk," or some other valid TLD.

As a result, it's not likely that these requests will ever reach your server, and so no code on your server can affect these requests.

I'd concentrate on finding the source(s) of these malformed domain requests and getting those links corrected.

Jim

Marls

6:03 pm on Dec 13, 2005 (gmt 0)

10+ Year Member



Kinda figured that would be the case :( But thanks so very much for your support!