我通过以下方式将myurl.com/anythinghere1/anythinghere2/sid/KEY重定向到myurl.com/file.php?KEY
RewriteRule ^([^/]*)/([^/]*)/sid/([A-Za-z0-9_-]+)$ file.php?sid=$3 [L]
效果很好。新路径myurl.com/anythinghere1/anythinghere2/sid/KEY应该正确显示在浏览器URL中。主要问题是file.php现在具有新路径/ anythinghere1 / anythinghere2 / sid /而不是根路径myurl.com/file.php,并且显示不正确(图像路径等)。如何为php文件定义原始路径myurl.com/file.php,但保持显示的浏览器路径myurl.com/anythinghere1/anythinghere2/sid/KEY?
如果我使用
RewriteRule ^([^/]*)/([^/]*)/sid/([A-Za-z0-9_-]+)$ http\:\/\/www\.myurl\.com\/file.php?sid=$3 [L]
浏览器路径myurl.com/anythinghere1/anythinghere2/sid/KEY?不见了。
谢谢您的帮助。