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
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.