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 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 如何提取csv文件中需要的列,将其整合为一篇完整文档,并进行jieba分词(语言-python)
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题