SEO Friendly URL Rewrites

I've seen lots of other questions and demos out there, but I'm still a little fuzzy on this business of search engine friendly URLs.

If I have a url like this:

How can I make this search engine friendly, without messing up the dynamic variables passed to my website, which determines content?

Also, is there a generic set of .htaccess rules that would work for this?  I have several sites that use this simple structure of

And I've seen some sites that look more like this: (no .php)
LVL 12
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you don't want to mess up the dynamic variables that popuplate the content, you'll have to pass the id in the new URL as well.

So, you could rewrite it from /services.php?id=1 to

A general rule for rewriting something like pageName.php?id=1 to pagename/asdf-1 could look like this:
RewriteRule ^([^\/]+)\/.+\-([0-9]+)$ /$1.php?id=$2 [L]

It takes the part before the / as the sectionname ( .php ), the second part is the pagename and page id.

so /asdf/sadfas-1 would go to asdf.php?id=1.

Hope this helps.
rowejdAuthor Commented:
This doesn't seem to be working.

RewriteEngine on
RewriteRule ^([^\/]+)\/.+\-([0-9]+)$ /$1.php?id=$2 [L]

Doesn't change my url:
No, it changes an url like /section/pagename-8 to /pagename/doesntmatter-8 to /pagename.php?id=8. It does not take extra folder depths in account. If you wan't to do things as extensive as that you might wan't to consider doing it in PHP itself.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.