Jump to content

Formatting Text for HTML links SEO


socalnate

Recommended Posts

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

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).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.