简体   繁体   中英

How to: URL Rewrite Dynamic PHP / MySQL URL for SEO

Currently my site's URLs are:

http://www.domain.com/accreditation_training_view.php?id=1

I would like the URL to be the page's title from the database instead. In the table, the title of the page is simply the 'title' column.

The page title is: "DISC Accreditation"

I would like the URL to look like this:

http://www.domain.com/disc_accreditation

Some pages have the '&' symbol in them. I would like them replaced with the word ' and '. I would like any uppercase letters reduced to lowercase.

I am just not sure the best way to attack the htaccess and corresponding php code. I have seen other examples on this site, but nothing exactly like this.

Any help is greatly appreciated.

Scott

I can't see any way to do it regularly by .htaccess because you need to get the page title (which is in the content of your site, where .htaccess can't access).

Yet, if you are using any CMS or framework (Wordpress, Joomla...,), there may be url-rewriting included (or via plugins), have a check !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM