Problem on redirect, login page and SEO

I have a SEO problem regards 301/302 redirection.


Here is the situation:

I have a domain, for example, [COLOR=Blue]http://mydomain.com[/COLOR]
All my public content is placed at [COLOR=Blue]http://mydomain.com[/COLOR]/myfolder/
Therefore, I have [COLOR=Blue]http://mydomain.com[/COLOR]/index.php to redirect to [COLOR=Blue]http://mydomain.com[/COLOR]/myfolder/

My site required all visitors to login.
Hence, all pages in myfolder will redirect to [COLOR=Blue]http://mydomain.com[/COLOR]/myfolder/[COLOR=DarkRed]login.php[/COLOR]

I want the search engine to crawl the login page ONLY.
I want the search engine to index it as [COLOR=Blue]http://mydomain.com[/COLOR]


To sum up, here is the redirection

[COLOR=Blue]http://mydomain.com [/COLOR]
-> [COLOR=Blue]http://mydomain.com[/COLOR]/myfolder/ -> (check if no login)
-> [COLOR=Blue]http://mydomain.com[/COLOR]/myfolder/[COLOR=DarkRed]login.php[/COLOR]


How should I wrote the redirect header?

Google seems alright with 302 redirections in both /index.php and /myfolder/[COLOR=DarkRed][COLOR=SeaGreen]whateverpage.php[/COLOR][/COLOR][COLOR=DimGray] (include /myfolder/index.php)[/COLOR]. It index [COLOR=Blue]http://mydomain.com[/COLOR] with the content in [COLOR=Blue]http://mydomain.com[/COLOR]/myfolder/[COLOR=DarkRed]login.php[/COLOR]
However, bing and yahoo cannot index my site.

Should I set everything as 301 redirections?

Thanks!