Installing in a sub directory
-
Hey,
I have an issue with mod_rewrite.
I have my WordPress instance installed in a sub directory but I don’t want to show that directory in the URL. I can reach the site like I wanted, but when I try to open /wp-login.php it gives me an “File not found.” error.
Can you help me with that?
My config currently looks like this:
`
# .htaccess in the root directory
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?domain.tld$
RewriteCond %{REQUEST_URI} !^/subdirectory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdirectory/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain.tld$
RewriteRule ^(/)?$ subdirectory/index.php [L]
</IfModule>
`
`
# .htaccess in the subdirectory# BEGIN WordPress
<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
`
`
// wp-config.php in the subdirectory// …
define(‘WP_HOME’,’https://domain.tld’);
define(‘WP_SITEURL’,’https://domain.tld’);
// …
`
Directory structure:
Domain points to /
WordPress is installed in /subdirectory
- The topic ‘Installing in a sub directory’ is closed to new replies.