Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

on the root page of a WordPress site we have a custom page template, that also handles some forms and dynamically changes part of the content.

Something like this:

<form action="" method="post">
...
<input type="hidden" name="action" id="action" value="do_this" />
</form>

and then in the page template we check for $_POST['action']=="do_this". Works perfectly.

Now we would like that when these forms are posted to have the url change (action="/do_this").

For that to work, we need /do_this to deliver the root page, but the url to not change.

we have tried this in .htaccess

RewriteRule ^do_this(.*)$ index.php?p=12 [L]

but it changes the browser url.

It must have something with WordPress, since if we use another file

RewriteRule ^do_this(.*)$ test.html [L]

it works: the url is not changed and the test.html is being delivered.

Thanks.

share|improve this question
    
so you mean to not refresh page but send the form data ? why don't you use ajax to handle it. –  amit Aug 1 '12 at 10:48
    
@amit: the page will refresh, the data it will be normally posted, but the new url should be mapped only internally to the same page –  memical Aug 1 '12 at 13:33
    
do you want to keep the url /do-this/ but with the content of index.php ? –  amit Aug 1 '12 at 13:45
    
yes :) true. basically to have the do-this url deliver the content of the root page, but i keep getting 404 errors from WP or apache does a redirect. this all works for another file, not index.php. –  memical Aug 1 '12 at 14:36
add comment

1 Answer 1

up vote 0 down vote accepted

a colleague fixed it using parse_request.

similar to this one:

http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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