我有一个位于文件夹“/mixtapes/”中的 .htaccess 文件,我正在尝试获取mydomain.com/music/downloads/mixtapes/this-title/id
要执行的 URLmydomain.com/music/downloads/mixtapes/item.php?title=variable1&id=variable2
我目前有下面的方法有点工作,但它只使用id,我需要两个变量(../mixtapes/title/id),由“/”分隔,并且由于某种原因,下面的代码在“/mixtapes/”中的索引页面“不起作用。我难住了!我对此有些陌生,非常感谢任何帮助!
顺便说一句,在我的索引页面上,传递到item.php
页面的 url 被重写为<a href="title/id">
我似乎无法让它以item.php?title=a&id=b
格式正确执行mixtapes/title/id
当前的 htaccess 文件位于“/mixtapes/”
# turn mod_rewrite engine on
RewriteEngine On
# rewrite all physical existing file or folder
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
# allow things that are certainly necessary
RewriteCond %{REQUEST_URI} "/css/" [OR]
RewriteCond %{REQUEST_URI} "/images/" [OR]
RewriteCond %{REQUEST_URI} "/images/" [OR]
RewriteCond %{REQUEST_URI} "/javascript/"
# rewrite rules
RewriteRule ^mixtapes/item.php(.*) - [L]
RewriteRule ^(.*) item.php?id=$1 [QSA]