2

我正在尝试将 CakePHP 应用程序安装在与 Wordpress 站点相同的目录中。CakePHP 应用程序只有几个控制器,所以我认为这应该可以通过添加几个RewriteConds. 不幸的是,以下 /.htaccess 文件无法正常工作:

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

#start my additions
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_URI} !^/tests
RewriteCond %{REQUEST_URI} !^/users
RewriteCond %{REQUEST_URI} !^/css/
RewriteCond %{REQUEST_URI} !^/js/
#end my additions

RewriteRule . /index.php [L]
</IfModule>

# END WordPress

#CakePHP rules
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/$
RewriteRule (.*) app/webroot/$1 [L]

由于某种原因,找不到 Wordpress 样式表:

GET http://example.dev/wp-content/themes/sow3/style.css?1365621024 404 (Not Found)

4

1 回答 1

1

看起来 cakephp 规则正在重写静态内容。尝试为重写添加一些条件:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/$
RewriteRule (.*) app/webroot/$1 [L]

或者

RewriteCond %{REQUEST_URI} !^/wp-content
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteCond %{REQUEST_URI} !^/wp-includes
RewriteCond %{REQUEST_URI} !^/$
RewriteRule (.*) app/webroot/$1 [L]
于 2013-04-11T04:01:10.143 回答