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
    you could do something like this instead – Milo Jun 18 '14 at 16:21
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, privacy policy and cookie policy

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