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 Link to comment https://forums.phpfreaks.com/topic/62277-formatting-text-for-html-links-seo/ 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. Link to comment https://forums.phpfreaks.com/topic/62277-formatting-text-for-html-links-seo/#findComment-309925 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 Link to comment https://forums.phpfreaks.com/topic/62277-formatting-text-for-html-links-seo/#findComment-309933 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). Link to comment https://forums.phpfreaks.com/topic/62277-formatting-text-for-html-links-seo/#findComment-309936 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.