Ouch, ouch. Where to start?
but when I want to try this redirection.
It gives me 404 not Found.
Where do you get the 404? At the originally requested URL (Login.aspx), at the new one, or somewhere else? If you are trying it in a browser, the address bar will say where the browser "thinks" it is.
I don't want another one that is
mystore.com/Page/Login.aspx
to be redirected by this 301 redirection rule
You have correctly handled this by using an opening anchor in your pattern. Can I assume this is happening in htaccess? If so, you are also correct to leave off the opening directory slash in the pattern.
Is this rule preceded by
RewriteEngine On
? Unlike most things in Apache, mod_rewrite activity isn't inherited. You need to turn it on afresh in each htaccess. (Twice, if you've got RewriteRules inside Files or FilesMatch envelopes. But you're not really supposed to do this anyway.)
You should also have
Options +FollowSymLinks
but this has almost certainly been turned on by your host already so it's not likely to be an issue if you forget it.
to
http://example.com/en/ukeurope/home
And then what? It is technically possible to have a file on your server named just "home" with no extension
yes, Phranque, I'm listening but in practice you'd never do it. So there would have to be a follow-up internal rewrite that takes the new URL and points to wherever its content "really" lives. It might even be "Login.aspx".
en/ukeurope/home? [R=301,L]
Ouch more. That is the worst possible form of a target. Include the full protocol and hostname. At an absolute minimum, start with a / directory slash. Assorted bad things can happen if you don't. At best, the server will use whatever you've set as your RewriteBase. (By default it would be the / document root.)
None of this answers the real puzzler:
original request
http://example.com/Login.aspx?ReturnUrl=%2fPages%2fHome%2fUser%2fWish-list.aspx
desired redirect
http://example.com/en/ukeurope/home
What happens the query string? You've explicitly removed it from the target by putting a ? at the end. But there's nothing in the rule that would constrain redirects to only requests with this particular query-- or any query at all. Do you
want to constrain the rule, or did you just put in the query as an example?
[edited by: bill at 6:59 am (utc) on Jul 23, 2013]
[edit reason] fixed typo [/edit]