Welcome Guest, Not a member yet? Register   Sign In
Wordpress + CODEIGNITER
#1

[eluser]Unknown[/eluser]
Hi friends,

I have installed wordpress on my root folder and codeigniter application in subfolder


But, When I request the subfolder CI is giving me 404 Error

Please help me

Here are the htaccess codes I am using


for Subfolder

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ sub/index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ sub/index.php/$1 [L]


Please help me out
#2

[eluser]mzalazar[/eluser]
hi adrevol, (excuse my english):

You have to avoid wordpress's index.php for the codeigniter subdirectory, this is how you have to do it:

Code:
RewriteCond $1 !^(index\.php|css|img|forums|your_subdirectory|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

This is something like "if somebody ask you for index.php, css, img, forum or you_subdirectory... please don't use index.php to serve that page"

instead... you have to tell your apache that use index.php's codeigniter to serve your subdirectory, just inserting this line with the others rewrite rules:

Code:
RewriteRule ^(.*/)?your_subdirectory/(.*) /codeigniterdir/index.php/$1 [L]

Attention: [L] tells Apache to not process any more RewriteRules if this one was successful.
i hope this works for you and all people with that problem.

Martin.
#3

[eluser]123wesweat[/eluser]
@mzalazar, i am trying to understand your solution

why do you put css img in your rewrite conditional??
#4

[eluser]mzalazar[/eluser]
I put it because i don't want to codeigniter to serve my css or img files, i need it to "bypass it" to been downloaded directly and without passing codeigniter's index.php
#5

[eluser]NateL[/eluser]
[quote author="123wesweat" date="1267339594"]@mzalazar, i am trying to understand your solution

why do you put css img in your rewrite conditional??[/quote]

You do that because of the way CI calls controllers.

If you had a controller called "Foo", and you wanted to access it, then you would type in this:

http://example.com/foo

However, if you have a CSS directory - you have to access it like so:

http://example.com/css/styles.css

The way CodeIgniter works is it would think /css/ is a controller - but it isn't. So, in your .htaccess file - you need to specify which actual folders you want CI to ignore.

Typical folders you'd ignore would be css, js, images




Theme © iAndrew 2016 - Forum software by © MyBB