mod rewrite - .htaccess RewriteRule / Redirect based on query string/parameters? -


how rewrite in .htaccess call url:

www.domain.com/?_wpm_gateway=paypal-standard&_wpm_action=ipn 

to point new ipn url (for paypal payments):

www.domain.com/payments/paypal/ipn 

with, obviously, rest of parameters in ipn being passed on , sent on new url?

any idea?

and need rewrite rule if query/url called, otherwise should business normal, speak.

edit: tried this, didn't work... ideas?

<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{query_string} (?:^|&)_wpm_action=ipn(?:$|&) rewriterule ^ /payments/paypal/ipn? [ns,l,dpi,qsd]  rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> 

you've got front. tell paypal new ipn url either in merchant settings, or per transaction in payment parameters send. don't redirect incoming ipn paypal. if worried missed ipns, silent internal rewrite of old new can processed without redirection.


edit: example of internal rewrite old url new. edit again should hit later rule on next pass, can make happen quicker in .htaccess

# ensure rewrite old paypal when query has right parameter rewritecond %{query_string} (?:^|&)_wpm_action=ipn(?:$|&) # should happen on first request , allow pretty url routed on next pass through rules rewriterule ^ payments/paypal/ipn [ns,dpi,qsd] 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -