I have a WordPress multisite using subdomains. I have created a new website, not using wordpress, which is on the root in a folder called 'home'

I am trying to remove the 'home' from the url so that it appears that this folder is the root eg. mydomain.com instead of mydomain.com/home/

I have added the following code into my .htaccess file:

RewriteCond $1 !^home
RewriteRule ^(.*) /home/$1 [L]

This removes 'home' from the url as desired. Unfortunately it stops all of the subdomains working in wordpress, so it's bypassing wordpress completely, I still need the rest of the subdomains to be working. Is there a way to make this work? Here is the complete htaccess:

Apache Rewrite Rules

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

Add trailing slash to url

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/|#(.))$
RewriteRule ^(.
)$ $1/ [R=301,L]

Remove .php-extension from url

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^.]+)/$ $1.php

RewriteCond $1 !^home
RewriteRule ^(.*) /home/$1 [L]

End of Apache Rewrite Rules

</IfModule>

BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

uploaded files

RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

add a trailing slash to /wp-admin

RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]

END WordPress

Recommended Answers

All 2 Replies

Are you using vhosts for your domain.com/home.. if so, did you change the document root in your httpd.conf file?

Not using vhosts. Never used it before. Is it straight forward to set up?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.