dreljie602951
2017-02-02 12:12
浏览 116
已采纳

WordPress:只有index.php的错误500

I'm actually working on a website for a small company. At first, I was doing some test on a sub directory (called "site") where my WordPress website was installed. The thing is that I wanted to finally deploy my website without moving the all content to the root directory. By the way, I found this tutorial https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory and followed it as I ain't completely familiar with WordPress.

By now I can access all my pages doing www.mywebsite.fr/index.php/page/ for example. But the problem is that I can't access the main page (without "index.php/page/" or even without "/page/"). It keeps returning error 500.

.htaccess (root directory)

# BEGIN WordPress

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

# END WordPress

index.php (root directory)

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/site/wp-blog-header.php' );

.htaccess ( '/site' directory)

RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]

index.php ( '/site' directory)

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

And the best of all, the client chose a web hosting without any php log... Someone have an idea? (Sorry for my English.)

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duannao3402 2017-02-02 12:25
    已采纳

    Check that the wordpress url is set to www.mydomain.com/site/ and the site address is set to www.mydomain.com

    It also looks like your root .htaccess is incorrect, try this (change mydomain.com to your domain)

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
        RewriteCond %{REQUEST_URI} !^/site/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /site/$1
        RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
        RewriteRule ^(/)?$ site/index.php [L] 
    </IfModule>
    

    You can also try changing the following line in the root index.php:

    require( dirname( __FILE__ ) . '/site/wp-blog-header.php' );
    

    to:

    require('/site/wp-blog-header.php');
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题