我不确定这是否可行。 我有以下网址结构
http://www.my-domain.com/layouts/page.php?artist=artist-name&link=1234
在地址栏中显示为
http://www.my-domain.com/artists/artist-name/1234
在.htaccesss文件中我有
RewriteEngine On
RewriteRule ^artists/([^/]*)/([^/]*)$ /layouts/page.php?artist=$1&link=$2 [L]
我想要的是隐藏最后一个变量(1234)在地址栏中显示但仍可在目标页面上进行处理。地址栏会显示
http://www.my-domain.com/artists/artist-name
如果无法做到这一点,我可以将变量(1234)保存到.htaccess文件中的cookie中,然后删除变量,使其不显示在地址栏中吗?然后我可以从cookie中的目标页面上获取它。
答案 0 :(得分:0)
尝试使用(.+)
。这样的事情:
RewriteRule ^artists/artist-name/\d+-(.+) /artists/$1 [R=301]