Search code examples
phpwordpress.htaccesssubdirectorydocument-root

Giving WordPress Its Own Directory when root is redirected to subfolder


So I'm setting up a WP-site on web-server using a subfolder as root for the main-page, and I can't get it to work. The true root is locked, so I can't access that.

The original .htaccess & index.html file is located in ftp://ftp.example//web/ and I want to install my WP in ftp://ftp.example//web/wp.

First I changed the the general settings in WP to:

WordPress Address (URL): http://www.example.com/wp

Site Address (URL): http://www.example.com

Then I copied index.php and htaccess to ftp://einstein.netureza.pt//web/ and changed line 17 in index.php to require( dirname( __FILE__ ) . 'wp/wp-blog-header.php' ); and updated the permalinks in wp-admin.

.htaccess now says:

## Default .htaccess file

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

# END WordPress

When I go to my url http://www.example.com I just get this error:

The strategy4change.eu page isn’t working

strategy4change.eu is currently unable to handle this request.
HTTP ERROR 500

However, visiting http://www.example.com/wp works.


Solution

  • I don't have enough reputations to comment. But I hope this is a valid answer:

    You missed a forward slash:

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