Question

I'm having some problems using zend framework 1.12 and wordpress at the same time..

I know the problem needs to be in the htaccess because zend framework and wordpress are working.

The problem:

if surf to localhost/blog it redirects me to the url localhost/public_html/blog. When that happens wordpress opens and says it can't find anything..

But if i open it with localhost/blog/hello-world (where hello-world stand for a post) it works like a charm.

How can i make sure that if i'm surfing to localhost/blog the index page of wordpress blog will show up and that i will not be redirected to localhost/public_html/blog -> "not found" page.

my htaccess in public_html:

SetEnv APPLICATION_ENV development

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^blog - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

and my htaccess in /public_html/blog/

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

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

# END WordPress

Thanks for reading and i hope someone can help me with this!

Greetings,

Cees

Était-ce utile?

La solution 2

I found the solution by myself so for the persons who are interested:

I placed the blog in /public_html/wordpress But i put my links to: /blog

my htaccess in public_html:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

and my htaccess in /public_html/wordpress/

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

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

# END WordPress

I also changed my index.php in /public_html/index.php because i'm skipping the Zend bootstrap when /blog is called.

<?php

$aExplodedUri = explode('/', $_SERVER['REQUEST_URI']);


if($aExplodedUri[1] == 'blog')
{
/**
 * 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__ ) . '/wordpress/wp-blog-header.php' );

}
else
{
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();    
}

You also need to change wp-config file and add the follow lines:

define('WP_HOME','/blog');
define('WP_SITEURL','http://www.yoururl.nl/wordpress');

Good luck!

Greetz,

Cees

Autres conseils

Remove this line from your root .htaccess :

RewriteRule ^blog - [NC,L]

If a folder/file is found by the system, it will be used!

And remove this line from your blog/.htaccess file:

RewriteRule . /blog/index.php [L]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top