I have reduced my actual problem to a simple one:
I have some php scripts that display text. Eg
http://example.com/articles.php?id=2
could display an article with title My little cat
.
However, the url is ugly for sharing. How can I implement a system whereby a user types something like http://example.com/articles/My_little_cat
and be redirected to the same place?
您可以通过在.htaccess
文件中定义RewriteRules来实现。
RewriteRule ^articles/My_little_cat/?$ articles.php?id=2
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.