Issue
I have gone through a lot of tutorials on apache,and could redirect few urls. Though,there is this url for which I need to do a redirect and I couldn't.Any help would be much appreciated! Thanks ! Note: Making changes to httpd.conf
URL : https://example.com/common/webScript.jsp?path=/example/content/latest.rss?section=Insight%26type=Leaders to https://example.com
As I have already configured my domain, Just need to redirect URL : /common/webScript.jsp?path=/example/content/latest.rss?section=Insight%26type=Leaders to /
Solution
uri-path after "?" character are query strings, you need to check them with %{QUERY_STRING} ^path` or similar. Rough example:
# to capture uri-path with query string starting with "path..."
# redirect it to /
# for 2.4 with If directive (most modern)
<If "%{QUERY_STRING} =~ m#^path#">
RedirectMatch ^ /
</If>
# or with mod_rewrite that works with 2.2 too
RewriteEngine on
RewriteCond %{QUERY_STRING} ^path
RewriteRule ^ / [R,L,QSD]
If you just want to redirect /common/webScript.jsp to / just do a simple:
RedirectMatch ^/common/webScript.jsp /
Answered By - ezra-s Answer Checked By - Terry (WPSolving Volunteer)