Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter rashuan

    (@rashuan)

    Looks like the add_rewrite_rule('^somepage/([^/]*)/([^/]*)/([^/]*)/?','index.php?pagename=somepage&target=$matches[1]&arrival=$matches[2]&departure=$matches[3]','top'); code was the way to go. Although I still couldn’t retrieve the GET part. So what I did was:

    1.) In the functions.php I’ve added a new rewrite rule as an init action:
    add_rewrite_rule(‘^hotels/([^/]*)/([^/]*)/([^/]*)-([0-9]*)/?’,’index.php?pagename=hotels’,’top’);
    2.) Since I couldn’t get the other GET parameters to work, I’ve just read the $_SERVER[‘REQUEST_URI’] from the plugin part and made appropriate checks of the ID from the URI.

    It does create quite a bunch of potential alternative links that would create issues with SEO. So, I’ll need to ensure that any alternating links that have same ID would be redirected to the original page.

    Thread Starter rashuan

    (@rashuan)

    Thanks. I’ll write down the solution once it works.

    Thread Starter rashuan

    (@rashuan)

    Thank you for the reply. I’ve tried doing everything with htaccess, but found out that WP Rewrite API is a better way. But using the add_rewrite_rule, I get the standard redirect with the link change. I thought that there might be some parameter or smth to keep the old link.

Viewing 3 replies - 1 through 3 (of 3 total)