socalnate Posted July 29, 2007 Share Posted July 29, 2007 Simple Question: I've got a database full of "game names" that I'm trying to format the game names that have spaces and other odd characters in them for the internet. Ex. http://www.mysite.com/[game name inserted here].html I need to filter anything that google or any other search engine wouldn't be able to index. Anybody have a general formula to format text for html links so they can be easily indexed? I didn't find a function in php for this but it'd be nice if they had one..maybe I just missed it? Nathan Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 29, 2007 Share Posted July 29, 2007 Sounds like mod_rewrite is what you need. Quote Link to comment Share on other sites More sharing options...
socalnate Posted July 29, 2007 Author Share Posted July 29, 2007 I'm currently using mod_rewrite but from my understanding google or any indexing engine will follow literal links, so I want to format it into a literal link via php and then I've already got a mod_rewrite that works pretty good already. Nathan Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 29, 2007 Share Posted July 29, 2007 I don't understand how that would be a problem. Just generate the link like you would with any other link. E.g. instead of echo "<a href='game.php?id={$id}'>Game</a>"; you could do echo "<a href='{$name}.html'>Game</a>";. Note: You need to make sure that there aren't any spaces and such in the name of course. You could use a regular expression or str_replace to remove all characters other than a-zA-Z0-9 (you could use _ for spaces). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.