我想要这样,如果用户输入webaddress/artist/P1/P2/,它会使用/artist/index.php?artist=P1&am=P2
I want it so that if the user types webaddress/artist/P1/P2/ it will make it use /artist/index.php?artist=P1&am=P2
P1 将是艺术家姓名,因此它可以包含字母和数字.P2 将是一个数字,所以只是数字.
P1 would be an artist name, so it could contain both letters and numbers. P2 would be a number, so just numbers.
我想要它,以便 P1 是必不可少的,而 P2 不是,因为现在它只返回在该地址上找不到的 404.当前代码:
I want it so that P1 would be esssential, whereas P2 isn't because right now it just returns 404 not found on that address. Current code:
RewriteEngine on RewriteRule ^artist/([^/]+)/(\d+)/$ /artist/index.php?artist=$1&am=$2 [L] 推荐答案/artist/index.php 暗示服务器上有一个根目录调用/artist/.我以某种方式怀疑这一点(它确实存在,但不应该).
/artist/index.php implies there is a root directory on the server call /artist/. I somehow doubt this (and it it does exist, it shouldnt).
删除艺术家之前的前导/,看看是否有效.
Remove the leading / before artist, and see if that works.
RewriteEngine on RewriteRule ^artist/([^/]+)/(\d+)/$ artist/index.php?artist=$1&am=$2 [L]更多推荐
htaccess 重写返回 404 not found
发布评论