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.

I am trying to do an email subscriber form and I would like to implement my own solution. I do not want to spend hours trying to figure out which Plugins is the best. Spending more times to install it in the template. And then realize that I can't easily send back a confirmation email to the subscriber... All I want is a normal .php file and do my job real fast inside.

Let's call that page sign-up.php

But, if I POST (even if I only GET) on that page, my 404.php is being displayed. How can I avoid this? I could probably go edit my .htaccess but I do not know if WP is going to overwrite it to get rid of my instructions.

Any tips?

I am using WP 3.4.1

share|improve this question
add comment

2 Answers 2

You could display the form on your WP site using an iframe and then the user would get confirmation without leaving the page.

There may be a more advanced solution but an iframe is easy and works.

share|improve this answer
    
I understand your solution. In that case, I must host the page somewhere else or in a sub-domain. I will try to find another solution before using yours. Thank you –  Cybrix Aug 27 '12 at 22:56
    
I believe you can host the file wherever you like, you could use something simple like yourwebsite.com/sign-up.php Good luck! –  Jo_pinkish Aug 27 '12 at 23:01
    
I believe this will be catched by the WP's .htaccess :( –  Cybrix Aug 27 '12 at 23:05
add comment

The core of Wordpress will not touch your .htaccess file outside the comments.

    # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Plugins such as WP Super Cache might but I've never experienced any loss of personal changes.

As to your request, you have options:

1/ i'd do a simple plugin so you keep all the benefits of wordpress (built-in security, awesome helper functions, etc.).

2/ You want your own php file, but use wordpress magic? You simply need to include wp-load.php . That's not recommanded though, but you're your own master...

3/ put your php file anywhere you want: it will work provided you have this rewrite condition before the rewrite rule : RewriteCond %{REQUEST_FILENAME} !-f : it says "if file exists, don't redirect to index.php".

share|improve this answer
    
The first solution would be the good way to go but I am totally new to Wordpress and I can't "afford" to spend hours on this. And I just noticed that I can actually post to my file but I have to provide the full path which isn't so clean: site.com/wp-content/themes/MySite-WP/sign-up.php. Best way should be to put another Rule before # BEGIN WordPress –  Cybrix Aug 27 '12 at 23:10
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.