I'm using the admin-ajax tool in WordPress to build a file generator. I have everything working, except that the current URL is ugly. I'd like to add a vanity URL that looks cleaner.

My Code

I am already using one vanity URL structure which works perfectly:

RewriteRule ^products/(building-automation|lighting-controls)/details/([^/]*) /?pagename=products/details&SKU=$2 [QSA,L]

However, this new one is not working:

RewriteRule ^downloads/datasheet-generator/([^/]*) /www/wp-admin/admin-ajax.php?action=fdm_generate_datasheet&SKU=$2 [QSA,L]


Why would this not be working?

  • Users should never see the admin-ajax.php URL. It’s only supposed to be used for background AJAX requests. Are you linking users directly to it? – Jacob Peattie Jan 16 at 15:53
  • I'm going to link people directly, which is why I don't want them to see it. – Andy Mercer Jan 16 at 15:55

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.