Skip to main content
edited tags
Link
Denyo
  • 21
  • 3
Source Link
Denyo
  • 21
  • 3

Keep requested/entered url with add_rewrite_rule

I've got url-rewriting partially working. I have this rule:

add_rewrite_rule('^somepage/([^/]*)/([^/]*)/([^/]*)/?','index.php?p=27&target=$matches[1]&arrival=$matches[2]&departure=$matches[3]','top');

When I request a page like this:

http://yourpage.com/wp/somepage/florida/02-03-2012/03-03-2012/

The Visitor gets redirected to:

http://yourpage.com/wp/somepage/

But I'd like to keep the additional parameters of the original url. How can I achieve this?

And I noticed something else. When I generate a link like above from a form via JavaScript I get "page not found" although the url is correct. Now when I refresh that same page I get redirected to the page mentioned above. Why isn't it working on the first try?

I'd appreciate any help.

Kind regards, Denyo