1

I want to make custom WordPress URLs like this :

http://example.com/index.php?productID=123 and for categories http://example.com/index.php?categoryID=123 and the reason is we have a website written in some old custom CMS and we want to move it to WordPress and we don't want to lose our indexes in google, The problem here is whenever we include index.php in custom URL rewrite it doesn't work and it automatically removes the index.php

here are the codes i tried:

add_rewrite_rule('index.php?p=(.*)', 'index.php?productId=$matches[1]', 'top');
add_rewrite_rule('index.php?cat=(.*)', 'index.php?categoryId=$matches[1]', 'top');

I also tried this plugin , it works fine but the problem is it converts the ? into %3F in URLs which causes 404 error

  • 4
    You should 301 redirect old urls to a better structure rather than try to maintain it on a new site. – Milo Mar 25 '18 at 0:23
  • The reason I do not want to do redirects 301 That Do not want You've got a downfall on Google Is there an extension in WordPress to edit posts manually? – Yaghoob Farhadi Mar 25 '18 at 1:02
  • 3
    @YaghoobFarhadi you realise that those old style URLs still work even with pretty permalinks turned on? The problem you face is not one of rewriting, it's that you need categoryId copying to cat etc – Tom J Nowell Mar 25 '18 at 2:13
  • The reason I do not want to do redirects 301 That Do not want You've got a downfall on Google Is there an extension in WordPress to edit posts manually? – Yaghoob Farhadi Mar 25 '18 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.