简体   繁体   English

404问题从Wordpress页面发送表单数据到CodeIgniter页面

[英]404 Issues sending form data from Wordpress page to CodeIgniter page

I have installed WP at my root directory and moved the CI application that was at the root to a sub-folder called "members." 我已经在我的根目录中安装了WP,并将位于根目录的CI应用程序移动到了一个名为“成员”的子文件夹。 The WP pages are working just fine, but when I try to sign into the CI application, using my log in form on a WP page, I'm getting back a 404 error. WP页面运行正常,但是当我尝试使用WP页面上的登录表单登录CI应用程序时,我又遇到了404错误。 I have a feeling this has something to do with routing and WP overriding things but I've been unable to figure this out so far. 我感觉这与路由和WP重写有关,但是到目前为止我还无法弄清楚。

.htaccess at root: .htaccess根目录:

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

# END WordPress

I wanted the info and members controllers in CI to still be accessible from WP. 我希望仍然可以从WP访问CI中的信息和成员控制器。

I can tell the CI page is being hit because I can still redirect the browser by adding a line in the controller, yet when I try to actually post data with the form and look at the Network activity in Chrome, I can see the 404 is coming back on the page I'm posting to. 我可以告诉CI页面正在被击中,因为我仍然可以通过在控制器中添加一行来重定向浏览器,但是当我尝试使用表单实际发布数据并查看Chrome中的网络活动时,我看到404是回到我要发布的页面上。

UPDATE: 更新:

Okay, I've been able to isolate this to being a routing issue, the problem is Wordpress is functional, but CodeIgniter isn't. 好的,我已经能够将其隔离为路由问题,问题是Wordpress可以正常运行,而CodeIgniter则没有。 I realize there's no modrewrite rules that apply to the /members/ directory. 我意识到没有适用于/ members /目录的modrewrite规则。 Here's where I'm at: 我在这里:

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

# END WordPress

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /members
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Any thoughts? 有什么想法吗?

It was a routing issue! 这是一个路由问题! I didn't realize I needed to put the Codeigniter specific .htaccess entries at the subfolder where the Codeigniter application resided. 我没有意识到我需要将Codeigniter特定的.htaccess条目放在Codeigniter应用程序所在的子文件夹中。 Of course it was that simple! 当然就是这么简单!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM