I am trying to install wordpress in a subfolder of an existing wordpress installation. I created a the subfolder /wp
unziped a fresh Wordpress download inside of that directory and added a .htaccess
with the following content:
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
However if I visit mysite/wp
I get an error 404 not found. I already tried the following: Restarting Apache and adding the .htaccess
content to the root .htaccess
. But it did not help.
I am trying to install wordpress in a subfolder of an existing wordpress installation. I created a the subfolder /wp
unziped a fresh Wordpress download inside of that directory and added a .htaccess
with the following content:
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
However if I visit mysite.com/wp
I get an error 404 not found. I already tried the following: Restarting Apache and adding the .htaccess
content to the root .htaccess
. But it did not help.
I didn't work with Apache for quite a while, so this is untested.
RewriteBase is the base for your rewrite, so it's added to your rule automatically and your .htaccess
should look something like this:
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Look here for further explanation: https://stackoverflow.com/questions/704102/how-does-rewritebase-work-in-htaccess
Also, you probably want to only put that in the .htaccess
file inside your /wp
directory.
/wp
subdirectory is included in the WordPress config? What happens when you requestexample.com/wp/
(with a trailing slash)? I would expect no difference, however, if you omit the trailing slash then you are relying on mod_dir issuing a 301 redirect to append the trailing slash (which is dependent on theDirectorySlash
directive). And what if you requestexample.com/wp/index.php
directly? Again that avoids mod_dir having to issue an internal subrequest to theDirectoryIndex
. So it's really just ruling our server config issues. – MrWhite Commented May 23, 2019 at 8:07example.com/wp/index.php
but I am still redirected to the theme default error 404 page. Also the request in the network tab is showing me error 404 in the header. – Mango D Commented May 23, 2019 at 8:49/wp
subdirectory. – MrWhite Commented May 23, 2019 at 11:47define('WP_HOME','http://new.spirigarchitektur.ch/wp');
anddefine('WP_SITEURL','http://new.spirigarchitektur.ch/wp');
. But it did not help. – Mango D Commented May 24, 2019 at 6:26