Apache Redirect Permanent For URL with Data in String (Question Mark)

有些话、适合烂在心里 提交于 2020-01-06 14:27:24

问题


I am looking for an Apache redirect where the source URL has a question mark in it.

Redirect permanent /course/view.php?id=68 http://exmaple.com/page.php

I've tried escaping the question mark, but that doesn't work. I've read a couple pages on the web about using Rewrite conditions, however it didn't quite make sense to me, or it was a little bit different than what I wanted to accomplish.


回答1:


Try adding the following to the .htaccess file in the root directory of your site.

RewriteEngine on
RewriteBase / 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /course/view\.php\?id=68 [NC]  
RewriteRule ^ http://exmaple.com/page.php [L,R=301]   


来源:https://stackoverflow.com/questions/9182585/apache-redirect-permanent-for-url-with-data-in-string-question-mark

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!