Title: PHP File Redirection 404 Error
Last modified: August 30, 2016

---

# PHP File Redirection 404 Error

 *  [jiungusa](https://wordpress.org/support/users/jiungusa/)
 * (@jiungusa)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/)
 * I have read the other posts regarding this but it was a different problem.
 * `<form action="mk.php" method="get">`
 * This form will call mk.php when the user submits the form. I have tried putting
   the mk.php file in the home directory, the wp-admin directory but the form can’t
   find it. I get a 404 error. In the URL bar, it shows
    [http://bdeas.com/marketplace/mk.php?username=test123&link=test123&submit=Send](http://bdeas.com/marketplace/mk.php?username=test123&link=test123&submit=Send)
   instead of [http://bdeas.com/mk.php?username=test123&link=test123&submit=Send](http://bdeas.com/mk.php?username=test123&link=test123&submit=Send)
 * Where am I supposed to place the mk.php file so that my page can find it?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [MonkimoE](https://wordpress.org/support/users/monkimoe/)
 * (@monkimoe)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403630)
 * [http://bdeas.com/marketplace](http://bdeas.com/marketplace)
 * make new directory “marketplace” and put mk.php there.
 *  Thread Starter [jiungusa](https://wordpress.org/support/users/jiungusa/)
 * (@jiungusa)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403726)
 * Then it doesn’t load in the original page that calls the php but,
    [http://bdeas.com/marketplace](http://bdeas.com/marketplace)
   but just shows the directory.
 * I need a way to place the php file or call the php file so that when /marketplace
   needs it, I can give it.
 *  [MonkimoE](https://wordpress.org/support/users/monkimoe/)
 * (@monkimoe)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403728)
 * If you put in root directory where wordpress installed,
    how about:
 * <form action=”<?php ABSPATH ?>/mk.php” method=”get”>
 * It will goes to: [http://bdeas.com/mk.php](http://bdeas.com/mk.php)
 *  Thread Starter [jiungusa](https://wordpress.org/support/users/jiungusa/)
 * (@jiungusa)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403731)
 * I get a _Oops! That page can’t be found.
    It looks like nothing was found at 
   this location. Maybe try one of the links below or a search?
    error again.
 * This was where it redirected to [http://bdeas.com/marketplace/%3C?link=test&submit=Send](http://bdeas.com/marketplace/%3C?link=test&submit=Send)
 * Still /marketplace.
 * This was what I used. `<form action="<?php ABSPATH ?>/mk.php" method="get">`
 *  [Christian Chung](https://wordpress.org/support/users/christian1012/)
 * (@christian1012)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403735)
 * Put it the theme root and try this:
 *     ```
       <form action="<?php get_stylesheet_directory_uri() . '/mk.php'; ?>" method="GET">
       ```
   
 * An even better way would be the following:
    In template:
 *     ```
       <form action="" method="get">
         <input type="hidden" name="jiungusa_form_nonce" value="<?php echo wp_create_nonce('jiungusa_form_nonce');?>">
   
       <!-- Rest of Form -->
       </form>
       ```
   
 * In functions.php
 *     ```
       add_action( 'init', function() {
         if( ! empty( $_REQUEST['jiungusa_form_nonce'] ) ) {
           require_once( 'mk.php' );
         }
       });
       ```
   
 *  Thread Starter [jiungusa](https://wordpress.org/support/users/jiungusa/)
 * (@jiungusa)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403739)
 * What do you mean by “theme root” and “in template”
 * I get functions.php but I don’t get the rest.
 *  [Christian Chung](https://wordpress.org/support/users/christian1012/)
 * (@christian1012)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403740)
 * The theme root is where you theme functions.php, index.php, and style.css are.
   The template is where you place the `<form>` code.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘PHP File Redirection 404 Error’ is closed to new replies.

## Tags

 * [form](https://wordpress.org/support/topic-tag/form/)
 * [html5](https://wordpress.org/support/topic-tag/html5/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [Christian Chung](https://wordpress.org/support/users/christian1012/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/php-file-redirection-404-error/#post-6403740)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
