【发布时间】:2017-06-08 14:00:43
【问题描述】:
我正在尝试将带有 ID 查询字符串的页面重定向到用户友好的 URL。我有多个这样的页面,我需要在 htaccess 文件中重定向。这是我尝试重定向的页面之一的示例:
旧网址:
examplepage.com/about_news_info.aspx?id=275
重定向到
新网址:
examplepage.com/news-events/
这是我没有运气使用的:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=275$
RewriteRule ^/about_news_info.aspx http://examplepage.com/news-events/test1 [L,R=301]
RewriteCond %{QUERY_STRING} ^cateid=373$
RewriteRule ^/about_news.aspx http://examplepage.com/news-events/test2 [L,R=301]
【问题讨论】:
标签: .htaccess mod-rewrite redirect