Site icon Hip-Hop Website Design and Development

How do I properly redirect requests to WordPress subdirectory?

Still learning things with WordPress installation. Was trying to follow this guide to redirect from public_html to wp so that visitors don’t see the page displaying available folders.

I’m not totally sure where I went wrong, but I may have put the WordPress address and Site address in reverse order on steps 3 and 4 while working on the setup.

It threw some kind of error when I pressed update (didn’t catch it or I would have posted it.)
Now my site is loading incompletely, with parts of the theme displaying. I am unable to log in and getting the following redirect:

http://www.example.com/wp/wp-admin -> http://example.com/wp-login.php?redirect_to=http%3A%2F%2Fexample.com%2Fwp%2Fwp-admin%2F&reauth=1 with a "Page not found" (presumably the 404 page).

My current directory looks like:

public_html
 |->.well-known
 |->cgi-bin
 |->example.com
 |->wp
 |.htaccess
 |favicon.ico
 |index.php

Where example.com is an unused FTP folder, and wp is the WordPress install directory.

.htaccess reads:


# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /wp/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>

# END WordPress

index.php reads:

 <?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp/wp-blog-header.php';

No other files have been subject to editing. Removing these two files bring back some functionality to the main page but most of the styling and images are not loading properly. example.com/wp/wp-adminand example.com/wp-admin remain 404’d in this state.

I don’t have shell access on this host. If you’re writing an .htaccess change out, please spell out what you’re doing for someone who’s not super familiar, and make sure it’s secure.