Support » How-To and Troubleshooting » 404 and Modrewrite

404 and Modrewrite

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)


    WordPress.org Tech Dude

    Actually, your rewrite seems to be working fine to me. Of course, it’s doing a redirect, but still…

    Well i always receive an error 404 from wordpress.

    I have installed the phpexec plugin so i have include in the page/resource-directory/ the real page

    => <phpcode><?php include(“links.php”); ?></phpcode>

    This needs the $category and/or $subcategory

    This works => RewriteRule ^resource-directory/(.*)\.(.*) http://www.health-weightloss-information.com/index.php?page_id=14&category=$1 [R=301,L]

    But this is not working => RewriteRule ^resource-directory/(.*)\.(.*) http://www.health-weightloss-information.com/index.php?page_id=14&category=$1 [L]

    When i remove the R=301.

    I know its something in the permalink functions of wordpress.

    So no one can help me ?

    It only works as a redirect because you are using the full URL including the domain name. Rewrites are usually to a file on the same server, so you should just use /index.php?page…

    Also, did you add something to WordPress’s index.php? Why not move your script to a different PHP file?

    I have seen WordPress return a 404 header when the WP header is used with custom scripts. You can fix this by putting
    header(‘HTTP/1.1 200 OK’);
    at the start of your script (it needs to be before anything is output, otherwise a header will be sent automatically).

    If i put my script in a different php file how can i use the theme in my php file ?

    For the rewrite i used also /index.php

    To use the WordPress theme, simply add add the top:

    define('WP_USE_THEMES', false);

    And at the end:

    get_sidebar(); get_footer();

    Are you still having rewrite problems or not?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘404 and Modrewrite’ is closed to new replies.