0

I have a site where http://mysite.com/wp-content/themes/mytheme/pdf.php creates a pdf of some content based on what's in a cookie.

That URL is pretty ugly. I'd love the url to simply be http://mysite.com/pdf.

I've tried to use mod_rewrite with no success. E.g. In my .htaccess file I have:

RewriteRule ^/pdf$ http://mysite.com/wp-content/themes/mytheme/pdf.php

This just returns a 404. Any ideas what I might be doing wrong?

Thanks.

1
  • 1
    you could do something like this instead
    – Milo
    Jun 18, 2014 at 16:21

2 Answers 2

0

This isn't strictly a WP question, but this should work - not necessarily the most efficient representation though:

RewriteRule ^(.*mytheme/)pdf.php http://mysite.com/pdf

This (http://martinmelin.se/rewrite-rule-tester/) is a very useful site for testing rewrite rules.

0

This is what ended up working for me:

RewriteRule ^pdf$ wp-content/themes/my-theme/pdf.php

It looks like removing http://mysite.com was the difference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.