.htaccess issues with CI3 inside Wordpress directory |
I have Wordpress installed in my web root and also have a directory inside that web root with Codeigniter 3 installed.
Code: /www When I visit a default controller method like Code: http://mydomain.com/codeigniter I can see my login page (codeigniter/auth/index). But I i visit anything beyond that, such as Code: /codeigniter/auth/login I get a 404 error in the javascript console and the error "No input file specified" in the browser. My Wordpress .htaccess: Code: <IfModule mod_rewrite.c> My Codeigniter .htaccess: Code: <IfModule mod_rewrite.c> I have tried everything, how do I make this work? If I add index.php back into my URL it works, but of course i don't want that. So http://mydomain.com/codeigniter/index.php/auth/login works but http://mydomain.com/codeigniter/auth/login does not work. How do I enforce the no index.php version (that works if CI is in it's own directory) while inside a WP directory? I have tried this, no luck. Wordpress: Code: <IfModule mod_rewrite.c> Codeigniter: Code: RewriteEngine on
Daft question but does mod rewrite work on your hosting. That would be the first thing to look at. Sadly configuring the htaccess for different environments is pretty hit or miss. Just keep trying different configurations.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
I usually just use a single .htaccess:
Code: # URLs routed to CodeIgniter
(02-26-2017, 11:38 AM)skunkbad Wrote: I usually just use a single .htaccess:Unfortunately this throws a 500 error on my CI pages.
(02-26-2017, 08:46 AM)ignitedcms Wrote: Daft question but does mod rewrite work on your hosting. That would be the first thing to look at. Sadly configuring the htaccess for different environments is pretty hit or miss. Just keep trying different configurations. Yes, wordpress and CI both work independently in different directories. (02-26-2017, 02:27 PM)baxterheinen Wrote:(02-26-2017, 11:38 AM)skunkbad Wrote: I usually just use a single .htaccess: This wasn't meant to be complete, it's just showing that I'm routing to two different front controllers. Also, systems vary, and sometimes a perfectly working .htaccess file doesn't work on another machine. Do be sure that in your apache config that you've got AllowOverride set to All. Just because mod_rewrite is enabled doesn't mean your .htaccess can do what you want it to.
(02-26-2017, 02:28 PM)baxterheinen Wrote:(02-26-2017, 08:46 AM)ignitedcms Wrote: Daft question but does mod rewrite work on your hosting. That would be the first thing to look at. Sadly configuring the htaccess for different environments is pretty hit or miss. Just keep trying different configurations. Are you sure about that? The structure you originally posted has Codeigniter as a subdirectory within WordPress. That means that /codeigniter/auth/login is routing through the .htaccess rule for WordPress most likely. It seems really simple to me. On your WordPress .htaccess, you would add: Code: <IfModule mod_rewrite.c> Any URI starting with codeigniter won't be processed in that first RewriteCond. I left it in parathensis incase additional items have to be added similar in the CodeIgniter .htaccess. The reason using codeigniter/index.php works is because of that !-f in the second RewriteCond which means the condition is true if the request is not a file. The following is if the request is not a directory.
Here is mine hope it will works with you.
My primary base folder for example is public_html and can access through http://localhost and I have CI project openspire that can be access through http://localhost/openspire/ And here is my .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /openspire/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /openspire/index.php [L] </IfModule>
There are those who tell lies with meaning behind them and those meaning less lies!
Oh make sure your mod_rewrite is also enabled!
There are those who tell lies with meaning behind them and those meaning less lies!
|
Welcome Guest, Not a member yet? Register Sign In |