rashuan
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Creating custom URLs for one pageLooks 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.
Forum: Fixing WordPress
In reply to: Creating custom URLs for one pageThanks. I’ll write down the solution once it works.
Forum: Fixing WordPress
In reply to: Creating custom URLs for one pageThank 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.