我的目标是实现以下目标:
我的查询: properties.php?id=1234-N-StreetName-etc
变成:
properties/1234-N-Beverly-Blvd.html
properties.php
将根据 mysql 数据库评估$id
(In this case ) 的值。any-address.html
如果某个值不在数据库中,则文件 properties.php 会将用户重定向到 404 页面。
$id 的值可以是字母字符、破折号“-”或数字的任意组合。
我的代码不起作用:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [nc]
RewriteRule ^properties/([a-zA-Z0-9_-]+)\.html$ properties.php?id=$1
你能帮我获得正确的 htaccess 重写代码吗?
PS。我对.htaccess 一无所知。我从示例网站修改了此代码。