【发布时间】:2013-09-14 16:18:36
【问题描述】:
我有一个 Code Igniter 网址:www.example.com,它运行良好。
现在我在根文档中创建了一个名为 pages 的文件夹,并在这个“pages”文件夹中安装了 wordpress。
我期待当我访问 www.example.com/pages 时,我会得到 wordpress 页面,但是当我打开 www.example.com/pages 时,它会自动重定向到 http://www.example.com/login
因此我无法查看我的 wordpress 页面。
我尝试过的:我将 .htaccess 文件更改为重定向,但它不起作用。我还检查了 wordpress 的数据库,但没有找到任何东西。默认站点(Code Igniter)与 Wordpress 有不同的数据库。
我位于 www.example.com 的 .htaccess 文件是这样的:
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
# If your website begins from a folder e.g localhost/my_project then
# you have to change it to: RewriteBase /my_project/
# If your site begins from the root e.g. example.local/ then
# let it as it is
RewriteBase /
# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)
# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]
# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|css|js|images|pma \.php|uploads|assets)
# No rewriting
RewriteRule ^(.*)$ - [PT,L]
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>
【问题讨论】:
-
Codeigniter 不会在默认情况下寻找名为
pages的控制器吗?这是您需要在路线中更新的内容吗? Docs -
Check this 以及这些答案(one 和 two)。
-
@jbird:我使用过 WordPress,但对 CI 来说绝对是新手。
-
@SheikhHeera:不,这是行不通的。在尝试了这些页面中的内容后,我仍然无法打开页面。
-
@jbird:我添加了以下几行 >>> $route['pages/(:any)'] = 'blog/$1'; $route['pages'] = '博客';
标签: wordpress codeigniter