I want my users to be able to choose whether they want their profile indexed on search engines or not. I know that this isn’t a guaranteed solution since some search engines may not follow my rules.
I searched a little but couldn’t find anything useful.
First, robots.txt isn’t “rules” per se but more a “suggestion”
So yes, though most search engines like Google and Bing will adhere to the robots.txt that is no guarantee all search engines will.
How to go about it really depends on how you have things set up.
If every user’s profile is in it’s own folder you could add them to robots.txt that way.
That sounds like a maintenance nightmare. Though it could be automated I suppose
I’m guessing the easiest way would be to automate it (using a checkbox in each profile page?) that would have a meta “noindex” added to the individual profile page.