0
RedirectMatch ^insights/(.*)\.html\?view=(.*)&p=([0-9]+)&/(.*)$ insights/$1/$2/$3-$4.html [R=301,L]

Please help me,why it is not working.

It is displaying error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log. Apache/2.2.22 (Ubuntu) Server at exlwebtest.cloudapp.net Port 80

1 Answer 1

0

You cannot match QUERY_STRING using RedirectMatch directive. Besides your syntax of RedirectMatch isn't correct. You're mixing that syntax with mod_rewrite syntax.

Use mod_rewrite rule. Place this in your root .htaccess file:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^view=([^&]*)&p=([0-9]+)&/(.*)$
RewriteRule ^insights/(.+?)\.html$ insights/$1/%1/%2-%3.html? [R=301,L]

It will be better if you provide examples of URLs you're trying to redirect.

6
  • Hello Anubhava it is Showing "The page isn't redirecting properly". Giving too many redirects. Apr 21, 2014 at 6:12
  • no Anubhava it is working but some other rules are not working. Actually i , first redirection and second i am mapping it to it's reffer url. So it gives me redirected url but not mapping with reffer url. Ex . www.xyz.com?view=aa&param=bb -- redirect it to www.xyz.com/aa/bb Then map www.xyz.com/aa/bb to www.xyz.com?view=aa&param=bb I am looking to achive this Apr 21, 2014 at 7:11
  • Well you haven't posted your other rules so I can't guess that. If you post your rules in question I can probably help you out.
    – anubhava
    Apr 21, 2014 at 7:16
  • These are actual rules : # redirection RewriteCond %{QUERY_STRING} ^view=([^&]*)&p=([0-9]+)&/(.*)$ RewriteRule ^insights/(.+?)\.html$ insights/$1/%1/%2-%3.html? [R=301,L] #mapping RewriteRule ^insights/(.*)/(.*)/([0-9]+)-(.*)\.html$ /insights/$1.html?view=$2&p=$3&/$4 [L,QSA,NC] Apr 21, 2014 at 7:19
  • No not in comments, code should be posted by editing question.
    – anubhava
    Apr 21, 2014 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.