I uploaded my project to a sub domain of my website. On that sub domain I installed wordpress on it and installed codeingiter to directory called app. The default controller is set to login which shows up when I go to the app/ url but once I click on any of the links "app/create-account or app/login" it takes me to wordpress default 404 error page. I am using codeingiter 3 and have been trying for a few days to get this working correctly. My class names are according to the styles required (ucfirst) and I believe it is something to with my htaccess file. Everything works fine on my localhost.
Current htaccess file in my codeingiter directory "/app/"
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
Current wordpress htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/app(/*)? - [L,NC]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Any suggestions are much appreciated :)
Related
i have a wordpress website
i have uploaded some of my php code at the root of my web where wordpress is installed.
i want to open those page directly.
they open if # www.example.com/newcode.php
but i want to open them like www.example.com/newcode (without extension .php)
the problem is when i put some .htacess code to achieve this, all wordpress pages stops and shows error404 not found and if i remove htaccess code then i cant open my own newcode.php page without extension
i tried to put this code in htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([^\.]+)$ $1.php [NC,L]
but doesnt work...
this is my wordpress .htaccess (automatically created by wordpress)
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([^\.]+)$ $1.php [NC,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
id have more files like newcode.php and some folder in which there are more code files and i want all of them to open like this
i want both wordpress pages as well as my new code page to open without any extension and i cant put newcode.php in seperate folder and make another htaccess for that specific folder
This is documented pretty clearly - especially in this case where you don't even need any regexp knowledge. Simply replace everything before # BEGIN WordPress with:
RewriteEngine On
RewriteRule /newcode /newcode.php [L]
I am working with Codeigniter and WordPress for a website.
Codeigniter installed on the root directory.
WordPress which is used for the blog in the subdomain directory inside the root folder.
Here is the directory structure.
var/www/html/codeigniter -- Root website here
/var/www/html/codeigniter/blog -- sub-domain for wordpress blog
here is the .htacess file for Root Directory (var/www/html/codeigniter)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
here is the.htaccess file for the blog directory (/var/www/html/codeigniter/blog)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
The subdomain you are trying to access must have a route associated to it in the application/config/routes and it should be pointing towards a valid controller function that returns a valid HTML/JSON data
it's working. I accidentally put the blog directory into another directory. Moving the blog on subdomain directory is working now.
I have installed WP at my root directory and moved the CI application that was at the root to a sub-folder called "members." 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. 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.
.htaccess at root:
# 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.
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.
UPDATE:
Okay, I've been able to isolate this to being a routing issue, the problem is Wordpress is functional, but CodeIgniter isn't. I realize there's no modrewrite rules that apply to the /members/ directory. 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. Of course it was that simple!
I have a WordPress website hosted at the root folder and in the same root another CodeIgniter website placed in a folder.
The CodeIgniter site is not loading now. IT shows page not found error
The URL structure will be: http://website.com - wp site and http://website.com/wi/ver1/
which means I put the CodeIgniter site in a folder wi/ver1/.
The htaccess code for the base wp site is :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And the httaccess inside the wi/ver1 directory is :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]
</IfModule>
Could you please try to help to solve this issue?
First of all check your site_url in wordpress project. Then change your RewriteRule . /index.php [L] with RewriteRule ^(.*)$ index.php?$1 [L] because it contains double backward slashes in your url .
if you want to load your codeigniter site, change base_url in config.php file, add your folder name that url
For example :$config['base_url'] = http://yoursite.com/folder_name/.
I have installed my wordpress installation on my server root e.g mydomain.com & codeigniter installed in subdirectory named ci e.g mydomain.com/ci. When I try to access my wordpress site it works fine, but when I try to access any of my ci controllers e.g mydomain.com/ci/signup it throw 404 Page Not Found CI error. but it worked fine for my default home controller. I have searched for solution & tried many of them but any one of them is not worked in my case.
here is the rewrite rules in .htaccess for my both installtion.
mydomain.com/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
mydomain.com/ci/.htaccess
RewriteEngine on
RewriteBase /ci
RewriteCond $1 !^(index\.php|user_guide|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
I think the problem is with wordpress .htaccess file. We should have to route the request that is for ci to ci folder.
This code might help, add this to wordpress .htaccess file
RewriteRule ^$ ci/$1 [L]
RewriteRule ^(.*) ci/$1 [L]