Welcome Guest, Not a member yet? Register   Sign In
CI + WordPress
#1

[eluser]CodeIgniterNewbie[/eluser]
I have a CI application which I want to run side by side with WordPress. CI will handle the core features of the application; WordPress will handle the simple pages (e.g. informational, etc.).

I don't want all the WordPress pages access through it's own subdomain or directory. I want the integration to appear seamless. So, I want something like the following:

www.domain.com/ (CI handles this)
www.domain.com/my-app/ (CI handles this)
www.domain.com/privacy/ (WordPress handles this)
www.domain.com/about/person-1/ (WordPress handles this)

The WordPress pages were working until I deployed my CI application to the same server. Now, when I try to access the WordPress pages, I get CI's 404 page.

How do I handle this?
#2

[eluser]Dam1an[/eluser]
Are you using htaccess which routes everything through the CI index.php?
#3

[eluser]CodeIgniterNewbie[/eluser]
Where do I check that? I've been using routes.php heavily. Does that helo?
#4

[eluser]Dam1an[/eluser]
in your web root, check if their's a folder called .htaccess

If you can call your URL like
Code:
www.domain.com/controller/function/arg
then you're using htaccess
If you have to use URLs like this
Code:
www.domain.com/index.php/controller/function/arg
then you're (almost certainly) not

If you are, you need to allow the wordpress paths in the htaccess
#5

[eluser]Stefano G[/eluser]
Hello, my site (http://www.stefanogiordano.it) is made of a normal CI installation (you can browse around using the navigation menu) and a Wordpress installation accessible via the following url: http://www.stefanogiordano.it/blog
without using any htaccess files.

I didn't link the blog section in the navigation menu because it is still under construction, but as you can see I made a WP template that has the same look of my website and then the magic is done!

This is possible because I have installed WP under the /blog directory in my site (at root level) you could do the same but I really don't see a true added value if you don't want to use all WP features...

cheers

Stefano
#6

[eluser]CodeIgniterNewbie[/eluser]
@Dam1an

I do call my URLs like this:

www.domain.com/controller/function/arg

This is the default way CI does things, right? So, how do I "allow the wordpress paths in the htaccess?"

@Stefano G

I'm trying to avoid the /blog/ in the URL.
#7

[eluser]Dam1an[/eluser]
Well the standar htaccess file is
Code:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

so I'd assume changing the condition to be
Code:
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico|privacy|about)
should do

But the problem with this is, if you have privacy or about in a CI URL, it'll probably fail
#8

[eluser]CodeIgniterNewbie[/eluser]
I'll give it a try -- and make sure there are no duplicate URLs between CI and WP. Thanks.
#9

[eluser]CodeIgniterNewbie[/eluser]
Just out of curiosity, is there anything I can do in the routes.php to handle this?
#10

[eluser]CodeIgniterNewbie[/eluser]
My .htaccess file looks like this:

Code:
RewriteEngine on

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]
Options -Indexes

Also, per http://httpd.apache.org/docs/1.3/howto/htaccess.html,

Quote:In general, you should never use .htaccess files unless you don't have access to the main server configuration file.

I'm on a dedicate hosting plan. What is the alternative way to handle this?




Theme © iAndrew 2016 - Forum software by © MyBB