我想用.htaccess创建一个友好的URL,而不使用任何id

时间:2016-05-05 06:43:59

标签: php

www.example.com/tour_detail/angkor-songsaa-luxury-private-island-honeymoon-premium-tour-19-105.html

注意:19-105是id,所以我不希望它像我想要的那样显示

www.exmaple.com/tour_detail/angkor-songsaa-luxury-private-island-honeymoon-premium-tour

1 个答案:

答案 0 :(得分:0)

把它放在.htaccess中:

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    ^angkor-songsaa-luxury-private-island-honeymoon-premium-tour/?$    angkor-songsaa-luxury-private-island-honeymoon-premium-tour-19-105.html    [NC,L]    # Handle requests for your url

如果您想阅读更多内容:https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/