Products
GG网络技术分享 2025-03-18 16:12 4
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 OnRewriteBase /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.)Check that the wordpress url is set to www.mydomain.com/site/
and the site address is set to www.mydomain.comIt 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\');
Demand feedback