I would like to know if there is an easy way to setup an htaccess file to abstract out redundant directories. On my webhost, I like to keep sites separate by using their domain name as the folder, as in the following:

+ public_html
  - domain.com/
  - otherdomain.com/
  - ...

However, this means that my main domain (domain.com) must point to this folder:
domain.com/domain.com/

My current htaccess file somewhat abstracts out the URLs to make it look transparent (WordPress is the backend):

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>
# END WordPress

So, if I visit domain.com, it really points to domain.com/domain.com and hides that from the user in the URL bar. However, file links do not have this nice abstraction. If I point to a file within my domain.com/files directory, it shows up as domain.com/domain.com/files. Is there an additional htaccess rule I can create to further remove the redundancy (i.e., point to domain.com/files).

Read more here: Using htaccess to abstract out redundant directory


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: