My WP moved from localhost to online, and now it shows a blank page (wp-admin is working normally). This is the structure: sub.domain.nl/dir1/dir2/WP-install
Something must me off with the redirecting I think after trying these: - removing all plugins - activate default template - change functions.php - turned on debug mode - played around with wp-config and .htaccess
codex.wordpress wasn't much helpful either as it, like most posts about this, wants me to place files (like .htaccess) in the root of the site.
The WP install should only be living in the sub.domain.com/dir1/dir2/WP-install
directory. Because there are other pages above: sub.domain.nl/dir1/dir2
(like a 'site menu').
The .htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?sub.domain.nl$
RewriteCond %{REQUEST_URI} !^/dir1/dir2/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dir1/dir2/$1
RewriteCond %{HTTP_HOST} ^(www.)?sub.domain.nl$
RewriteRule ^(/)?$ dir1/dir2/index.php [L]
</IfModule>
Another try at the .htaccess
(this does display the site, but all the links get duplicated like: https://www.sub.domain.nl/sub.domain.nl/dir1/dir2/index.php
)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub.domain.nl/dir1/dir2/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sub.domain.nl/dir1/dir2/index.php [L]
</IfModule>
# END WordPress
Update
I changed the RewriteBase and RewriteRule to:
RewriteBase /internship/avans/
RewriteRule . /internship/avans/index.php [L]
Frontpage gets displayed correctly, wp-admin work like before, and some page/post links work ?!? Some get the following error (also after clearing cookies):
Not Found The requested URL /sub.domain.nl/dir1/dir2/index.php was not found on this server.
I removed those pages and reposted them, they work fine now. No idea what this irregular behavior causes. I checked my DB for wrong updates links as sub.domain.nl/sub.domain.nl
within phpMyadmin and with Search/Replace, but that seemed not to be the case.
Anyhow, it now works- but I am still wondering what caused some links to work and some of then to reproduce the double links and consequently a Not Found error.
Update 2
I ended up using the suggested .htaccess
by @MrWhite down below:
Read his post for elaboration!
# 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
htaccess
file and then let WP create it again for you by saving the permalink settings again. – Antti Koskinen Feb 16 at 8:51