404 error on all but home page

Home Forums BulletProof Security Free 404 error on all but home page

Tagged: 

This topic contains 13 replies, has 4 voices, and was last updated by  Alex Laxton 1 week, 5 days ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #4702

    Joe Lowery
    Member

    My client’s site has a WP install within a sub-folder and I’m using the following code in my .htaccess file to show linked pages:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /rhap/blog/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /rhap/blog/index.php [L]
    # END WordPress

    First, I tried using the BPS .htaccess files as generated and I received 404 errors on all but the home page. Then I tried adding the custom code (all but the #BEGIN and #END lines) to the custom code section of the plug-in, but I still get 404’s. What am I doing wrong?

    Thanks – Joe

    #4703

    AITpro Admin
    Keymaster

    The RewriteBase and RewriteRule are not valid.  You ONLY add the actual folder name where the website is installed and NOT additional folders that are above that folder.

    RewriteBase means the actual folder name where the website is installed in.

    If the website is installed in the /blog folder then the RewriteBase is RewriteBase /blog/

    and the RewriteRule would then be RewriteRule . /blog/index.php [L]

    #4707

    Joe Lowery
    Member

    Thanks for the speedy response! So, does this look right:

    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]

    Thanks – Joe

    #4708

    AITpro Admin
    Keymaster

    Yes, that is correct WordPress .htaccess code for a subfolder site installed in the /blog folder.  If using [obsolete-removed] did not create the correct RewriteBase then that means your WordPress General Settings are not valid.

    Go to Settings >>> General and check your WordPress Address and Site Address URL’s

    Example for the AIT-pro.com Blog subfolder site that is installed in the /aitpro-blog folder:

    WordPress Address (URL)  http: //www.ait-pro.com/aitpro-blog
    Site Address (URL)   http: //www.ait-pro.com/aitpro-blog

    #4711

    AITpro Admin
    Keymaster

    Typically you would probably not want to install a subfolder site under another subfolder site if that is what you have done. Let’s say you have a WordPress installation here: /rhap and you want to install an additional subfolder site and it will be the blog site for the /rhap site.

    Your folder structure would be this…
    /rhap – is the main site
    /blog – is the blog for the main site

    …and not this /rhap/blog.  You can do this I think, but it is not the recommended best site architecture.

    The URL structure on the frontend of the website would be the same for both folder structures, unless of course you were doing something like this, but this is probably a very bad idea.

    /main-site/another-site/blog-site

    #4713

    Joe Lowery
    Member

    Ok, got it. Everything is working fine now. Thanks!

    #36634

    ALEX KIBET MUHINDI
    Participant

    Hi,

    Just installed BPS pro but I get error 404 on all but my home page.

    Kindly advise

    #36635

    AITpro Admin
    Keymaster

    This sounds like a common htaccess code rewriting problem or a WordPress General Settings problem.  See the information above in this forum topic.  Are you WordPress General Settings correct?  Is your root htaccess code correct?  Go to the BPS > htaccess File Editor tab page > Your Current Root htaccess File tab > copy and paste all of your root htaccess file code in your forum reply.

    #36636

    ALEX KIBET MUHINDI
    Participant

    [Root htaccess file checked and then deleted by AITpro Admin]

    #36637

    AITpro Admin
    Keymaster

    Your root htaccess file and code looks good. So check your WordPress General Settings and also check your WordPress Permalinks.  Post your WordPress Permalink Structure in your forum reply so I can see what you are using for your Permalinks.

    #36638

    AITpro Admin
    Keymaster

    Actually your website is now HTTPS and not HTTP and you are not using HTTPS/SSL htaccess code in BPS Root Custom Code and your Root htaccess file.  See this forum topic link below for how to add that.  Also make sure your WordPress General Settings URL’s are https and not http.

    https://forum.ait-pro.com/forums/topic/wordpress-ssl-htaccess-code-rewrite-ssl-rewritecond-server_port/#post-7233

    #36639

    ALEX KIBET MUHINDI
    Participant

    ok…It has worked.
    I see the below error when I try to add products.
    One or more database tables are unavailable. The database may need to be repaired.
    Regards

    #36640

    AITpro Admin
    Keymaster

    Great! Glad to hear the rewrite problem with HTTPS is now fixed.

    I did a Google search for that WordPress error message and found these search results below.

    https://www.wpbeginner.com/wp-tutorials/how-to-fix-the-error-establishing-a-database-connection-in-wordpress/

    https://wordpress.org/support/topic/one-or-more-database-tables-are-unavailable-the-database-may-need-to-be-repaire-8/

    #38133

    Alex Laxton
    Participant

    I agree with admin he will give the best solution to you and hope I can also suggest valuable but I don’t have much coding knowledge.

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.