Is this valid and correct?
RewriteRule ^myOldPage.html$ /index.php#info [R]
I'm specifically interested about the #info
part.
Is this valid and correct?
RewriteRule ^myOldPage.html$ /index.php#info [R]
I'm specifically interested about the #info
part.
Although it looks correct, I have a strange feeling this won't work.
The browser needs to know about the #anchor. The server and mod_rewrite may well just ignore it.
If it doesn't work I guess you could do something like..
RewriteRule ^myOldPage.html$ /index.php?info=true [R]
and then in the php output a piece of javascript to do the anchor jump.
Yes. That's a valid 301 redirect (the HTTP standard allows for any valid URI to be provided as the redirect).
Now the caveat: Not all search engines may love the redirect. Google does a fantastic job of handling anchor tags (they even have a patent on this), while others will completely ignore them. As long as that's not an issue, the redirect is technically valid.
Update: If you're having trouble with mod_rewrite, try the NE (no escape) flag to prevent the # symbol from getting encoded:
RewriteRule ^myOldPage.html$ /index.php#info [R,NE]