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

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');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?