我试着自己重写,但做不到,基本上,我想用.htaccess重写基于php的URL,但也需要跳过几个php的参数;
原始网址: http://example.com/details.php?id=62?title=billions-s01e09-webrip-x264-fumettv
必需格式: http://example.com/billions-s01e09-webrip-x264-fumettv-id62.html
格式序列:MySiteURL/Title-of Post-PostID.html
如欲寻求好意的回复,请指导我如何通过.htaccess来实现这一点。等待善意的回应..。日安
发布于 2016-06-09 06:37:59
正如您已经知道的,您必须更改服务器中的.htaccess文件。您可以使用regx来实现所需的url。使用以下代码可以帮助您。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9-]+)-id([0-9]+).html?$ details.php?id=$2&title=$1 [QSA,L]对我来说很好。希望也会对你有用。
发布于 2016-06-09 05:00:29
重写
至
您可以使用以下规则:
RewriteEngine on
RewriteRule ^([^-]+)-id([0-9]+)\.html$ /details.php?id=$2?title=$1 [NC,L]https://stackoverflow.com/questions/37716976
复制相似问题