Forum Moderators: phranque

Message Too Old, No Replies

Is this correct?

         

smallcompany

7:08 am on Jan 19, 2010 (gmt 0)

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



It happened that folder "page" has become a page as there was no need to maintain it as a folder.
I made those three entries:

RewriteRule ^page/$ http://www.example.com/page.html [R=301,L]
RewriteRule ^page$ http://www.example.com/page.html [R=301,L]
RewriteRule ^page/index\.html$ http://www.example.com/page.html [R=301,L]

Are they "grammatically" correct?

Also, while having the above where I redirect index.html into something else, at the same time, is it OK to have a section that translates index.html into a parent folder:

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

Can all this combined create some kind of loop that creates non-existing folder structure?

I'm just trying to troubleshoot recent avalanche of requests from Google and Yahoo for strange structured where they would build one subfolder onto another. (example.com/folder/folder1/folder2/folder3/ while they are all subfolders at the same root level)

When I check my site manually, all is ok. If I use a tool that creates a sitemap, all links are fine.

:s

Thanks

g1smd

10:02 am on Jan 19, 2010 (gmt 0)

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



Your first three rules can be simplified to one:

#Redirect /page or /page/ or /page/<anything>.html to /page.html at www

RewriteRule ^page(/¦(/([^.]+)\.html))?$ http://www.example.com/page.html [R=301,L]

Change the broken pipe to a solid pipe if you copy and paste code from this forum.

smallcompany

11:01 pm on Jan 19, 2010 (gmt 0)

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



Thanks.

Is this just for anything under "page" folder, or index page only?

jdMorgan

2:36 am on Jan 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The comment in g1smd's code seems clear that it handles all cases...

Jim