0

As can be seen in this dem0site.net (which has been installed to its own subdirectory (public_html/wp-org-01/), I have successfully followed the Codex instructions for "giving WordPress its own directory" (using a pre-existing subdirectory install).

The site's externally-visible URL has been changed from http://dem0site.net/wp-org-01 to simply http://dem0site.net. And the "pretty permalinks" to individual posts also appear the way I want them to -- for example: http://dem0site.net/hello-world/.

However, I would like to get rid of all external traces of the 'wp-org-01/' installation-subdirectory, which still show up:

  1. when hovering over the 'Site Admin' element of the 'Meta' widget, which shows: http://dem0site.net/wp-org-01/wp-login.php
  2. for images and other items in the 'uploads' directory, such as http://dem0site.net/wp-org-01/wp-content/uploads/2015/01/WordPressOrgIcon1.png.

Is it possible to fully mask all such external traces of installation-subdirectory, using just '.htaccess' and standard WordPress settings, but without relying on any plugins?

0

For the sake of anyone interested in the answer to this question, I am posting here the following answer that I received in the WordPress.org support forums.

leejosepho graciously provided the following answer:

Yes, that is possible. Save 'http://dem0site.net' in both boxes at Dashboard > Settings > General, then cPanel-assign and -point your domain to public_html and use this htaccess to redirect it to 'wp-org-01' (or wherever):

# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
#RewriteRule ^(/)?$ subdirectory/index.html [L]
## index.php for WordPress
RewriteRule ^(/)?$ subdirectory/index.php [L]

Visitors to your Web site will not be able to tell that your main domain is using a subdirectory, they will still see the Web site address as http://www.example.com/... https://my.bluehost.com/cgi/help/347#redirect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.