htaccess rewrite returns 404 not found

本小妞迷上赌 提交于 2021-01-27 21:15:26

问题


I want it so that if the user types webaddress.com/artist/P1/P2/ it will make it use /artist/index.php?artist=P1&am=P2

P1 would be an artist name, so it could contain both letters and numbers. P2 would be a number, so just numbers.

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]

回答1:


/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]


来源:https://stackoverflow.com/questions/21223329/htaccess-rewrite-returns-404-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!