Install Wordpress in subdirectory as addon domain and remove install folder in url

264 Views Asked by At

I have installed an addon domain and created a subdirectory in the public_html folder where I installed wordpress for the new site. Everything works fine except the I cannot remove the subfolder from the url. I presume chhanging the htaccess file in the addondomain is the problem.

wordpress address url http://addondomain.com/addondomain site url http://addondomain.com

in index.php in the addondomain folder I changed

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

to

require( dirname( __FILE__ ) . '/addondomain/wp-blog-header.php' );

my htaccess file in the addon directory

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /addondomain/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /addondomain/index.php [L]
</IfModule>

The htaccess file in the main public_html directory (contains files of another domain)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

All I want is to remove the wordpress installation folder from the url, but I have a domain and subdomain and two wp installations.

2

There are 2 best solutions below

0
AudioBubble On

The problem was actually in the root folder of the addon domain which was set to the root directoryy, not subdirectory.

0
AudioBubble On

Remove /addondomain from the last rule in .htaccess file in the addon directory (RewriteBase stays as before).

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /addondomain/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress