I'm having this issue: I have a WP install on root. So far so good.
Now I'm installing another version on a subdirectory, and it doesn't work. I have done this many times before, but maybe because of a server configuration, maybe something changed on new WP versions, it doesn't work in this case. It doesn't create permalinks (I have checked permissions) and if I use a custom structure, it goes to the main install and displays its 404 page. However, if I set permalinks as plain, it displays just fine.
Another thing I noticed is that if I try to customize the site, it asks me to log in because my session has finished. No matter how many times I try to log in, it kicks me out.
Just in case, WordPress Address (URL) and Site Address (URL) are correct, with no trailing slash, but they look grayed out. I also added the following lines to wp_config.php to no avail
define('WP_HOME','https://www.example.com/landing'); // NO trailing slash at the end
define('WP_SITEURL','https://www.example.com/landing'); // NO trailing slash at the end
Anyways, I spent the last hours checking documentation and similar questions here and on other sources, but nothing works and I'm completely lost. Any idea on what am I doing wrong, or what can I do to force this to work?
EDIT
I see that the wp-config file on root has this code added, don't know if it matters, but adding it just in case (IP address edited):
if( ini_get("max_input_vars") < 5000)
{
echo "Set max_input_vars upto 5000";
exit;
}
if($_SERVER['REMOTE_ADDR'] == '123.123.123.123')
{
define('DISALLOW_FILE_MODS',false);
}
else
{
define('DISALLOW_FILE_MODS',false);
}
and .htaccess file on root:
#<FilesMatch ".(eot|ttf|otf|woff|css|js|svg)">
# Header set Access-Control-Allow-Origin "*"
# </FilesMatch>
Header set Access-Control-Allow-Origin "https://beta.example.com"
# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
allow from 111.111.111.33
allow from 206.111.111.184
allow from 206.111.111.185
allow from 127.0.0.1
</Files>
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
php_value max_input_vars 5000
# 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
<IfModule mod_headers.c>
ExpiresActive On
ExpiresDefault A29030400
<FilesMatch "\.(jpg|jpeg|gif|png|js|css)$">
ExpiresDefault A7200
Header append Cache-Control "private, must-revalidate"
</FilesMatch>
</IfModule>
AddOutputFilterByType DEFLATE text/plain
#AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
<Files *.htm>
#Compress
SetOutputFilter DEFLATE
</Files>
# start Emerson adds
# Protect wp-config.php file
<files wp-config.php>
order allow,deny
deny from all
</files>
# Block the include-only files
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
# Prevent people from browsing the content of your directories
Options All -Indexes
# Protect the .htaccess file itself
<Files .htaccess>
order allow,deny
deny from all
</Files>
# block ip addresses from login to the site
# order allow,deny
# deny from 456.123.8.9
# allow from all
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
.htaccess
is not used in nginx. Check with your hosting company on where thenginx.conf
and virtual-server config (it usually in/etc/nginx/site-available/
file located and add thelocation
directive andserver_name
for your subdirectory as suggested by @motivast. You probably don't need to change the rest of the nginx.conf and virtual-server config.