【发布时间】:2015-06-03 20:21:07
【问题描述】:
我正在使用 .htaccess 获取如下所示的 URL:
/index.php?page=2
并将它们重写为,例如:
/contact-us
我想做两件事:
加载 /contact-us 时,显示页面 /index.php?page=2 但保留友好的 URL。我知道这看起来像:
RewriteRule ^contact-us$ "index\.php\?page\=2" [L]
哪个工作正常。但现在我还希望导航到 /index.php?page=2 的人最终访问 /contact-us - 我如何通过 301 重定向和友好的 URL 重写来实现这一点?
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect url-rewriting