I have few questions and I need your advice. So I'm building mini CMS system where users submit content and I construct an url from their content's headline and id eg "74/my-name-is-john-stewart" and insert it to DB besides original context. When I retrieve data with GET method deal?url=74/my-name-is-john-stewart I wonder how to convert that link to deal/74/my-name-is-john-stewart format like in Stackoverflow. And I have doubts if it's a proper way, cause when user deletes id number part, different content is loaded, but url's title part stays the same. I'm afraid , maybe it might cause some SEO problems in the future?
You can use these rules in /deal/.htaccess
:
RewriteEngine On
RewriteBase /deal/
RewriteCond %{THE_REQUEST} \s/+(deal)\?url=([^\s&]+) [NC]
RewriteRule ^ /%1/%2? [R=302,L]
# internal forward from pretty URL to actual one
RewriteRule ^([^/.]+)/?$ ?q=$2 [L,QSA,NC]
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.