• I have a separate invoicing PHP application on my server in a folder named “clients”

    But when I go to mydomain.com/clients I get a wordpress 404 Page error in when it should bring up the login screen for the invoicing PHP application at that directory.

    is there a way I can override the wordpress 404 error so that I can access the PHP application in the /clients folder?

    I have tried editing the .htaccess file following directions on a stackexchange answer to a similar question, but when I edit I get a 500 error on my entire site. Any suggestions or any way to modify the 404.php file or a plugin I can use?

    Here is the .htaccess edit I have tried:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /mydomain/
    RewriteRule ^index\.php$ – [L]
    RewriteRule ^/?clients(/|$) – [END,NC] #<<<<<<<<<<<<THIS IS THE LINE I ADDED
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /mydomain/index.php [L]
    </IfModule>
    
    # END WordPress

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    • This topic was modified 7 years, 11 months ago by jambog82.
    • This topic was modified 7 years, 11 months ago by jambog82.
    • This topic was modified 7 years, 11 months ago by bdbrown.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Bunty

    (@bhargavbhandari90)

    Thread Starter jambog82

    (@jambog82)

    This doesn’t seem to work. With this plugin I am basically redirecting https://www.mydomain.com/clients to https://www.mydomian.com/clients&#8230; the same URL. When I try to do this with redirection, or any other 404 plugin, it says the redirection URL can’t be the same. I don’t think a plugin will work for what I need. I will either have to modify .htaccess or modify 404.php somehow, I just don’t know how exactly.

    Moderator bcworkz

    (@bcworkz)

    If you request the invoicing app’s entry file directly, WP should not even be involved, as the WP rewrite is only invoked when there is no matching file or directory on the server. If you want to rewrite ‘/clients/` to a more convoluted path as essentially a shortcut, you could place a symlink called clients that points to the actual location. Or use .htaccess redirect or rewriterule, but keep it completely separate from the WP entry.

    Thread Starter jambog82

    (@jambog82)

    If you request the invoicing app’s entry file directly, WP should not even be involved, as the WP rewrite is only invoked when there is no matching file or directory on the server.

    Even when I type https://www.mydomain.com/clients/index.php I still get a 404 error. I’m not even sure how to be sure my php app is installed correctly. Even if it wasn’t I would think I would get a php error instead of a 404 error.

    I found a similar wordpress plugin to the client app I am using, so I may end up purchasing a premium version of that to use instead. Still would like to understand why I’m getting the 404 error though :/.

    Moderator bcworkz

    (@bcworkz)

    Have you restored the WP .htaccess rewrite code to its default condition? Is there any other .htaccess code that involves rewrites or redirects? Improper .htaccess rules can cause 404s despite the presence of the target file.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Bypassing 404 pages’ is closed to new replies.