Code igniter and wamp not finding files in different folder - codeigniter

I happened to run into this problem with a code igniter based folder/site in my wamp's www folder, the folder is named igniter and the site works great on that folder, but when I copy paste that folder or simply rename it, the routing stops working.
To be more specific, I enter the newly renamed folder/site via browser, like http://localhost/igniter2 for example, and the code igniter routes to the default/homepage intended but when I try to access any other page via links or direct routing all I get is a 404 page not found error, even if I try to click the homepage link in the homepage it gets the same error.
I tried to look everyone but didn't find answer, can someone help me figure out the problem?

I checked the file www/igniter2/.htaccess and on the first 3 lines i saw:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /igniter/
and changed to:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /igniter2/
Now works wonders :) thanks curious_coder for the tip.

Change the 'base_url' parameter to 'http://localhost/<new_folder_name>/' in config.php.
config.php is present in 'application/config/' folder.
In your case:
$config['base_url'] = 'http://localhost/igniter2/';

Related

Code igniter - 404 not found, routes issue, ssh server

So first off, I am pretty familiar with codeigniter I've used it for multiple occasions. Right now I have a project too do for school and I installed codeigniter on the server but I am getting routing issues I believe.
So additional info about the server which is different from the normal environment I work with, the server uses SSH and it is very weirdly protected in my opinion. You also need a username and password to view the URL in the first place. (I think it's weird)
If this helps the url is:
https://clipper.encs.concordia.ca/~pyc353_2/
and credentials are (username: pyc353_2, password: FMaqRb)
Now I am able to see any page that I set as my 'default_controller' in the routes, but the problem is trying to go to any other page. Right now I'm trying to access the register controller and I just get 404'd (while it works if I set it as default)
I will link all the code I think may be relevant to the error, hopefully it's not server settings since I have no control over any change.
config.php
$config['base_url'] = 'https://clipper.encs.concordia.ca/~pyc353_2/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
routes.php
$route['default_controller'] = "test";
.htaccess (there may be better code for doing this but I used it in the past no problem and the route doesn't work even if I remove htaccess and add back index.php to 'index_page')
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
</IfModule>
So I tried accessing my pagedifferent variations in the url such as: (stackoverflow won't let me post more than 2 physical links)
clipper.encs.concordia.ca/~pyc353_2/register
clipper.encs.concordia.ca/~pyc353_2/index.php/register
neither work although with /index.php/ the error message is: "No input file specified."
So I hope my explanations are clear enough, it's hard to explain something I don't understand the source problem. If you need any additional info feel free to ask. I really need to solve this to proceed at all for my project.
EDIT
I don't know if this is relevant but the 404 message is not even in the codeigniter style it just looks like a plain web 404
Also I am looking at the path on the server and this is the hierarchy: /www/groups/p/py_comp353_2 I don't know if that could affect anything also?
NEWER EDIT
Following what I found here: http://ellislab.com/codeigniter/user-guide/installation/troubleshooting.html
Changing index.php to index.php? (and removing htaccess) actually did make the routing work. Now I am happy enough with this and I can continue working, but being that it's an ugly solve would anyone know how to keep the routing working AND remove the index.php? from my URI?
It appears that your htaccess is not working.
To confirm, create a new PHP file and write this line:
echo phpinfo();
On that page try to search for "mod_rewrite", if it is enabled, you will see it under "Loaded Modules"
It is probable, it is not enabled.
Try this on your server:
a2enmod enable
Then restart the apache server.
For restarting on debian, this should work:
service apache2 restart
For CentOS, this should work:
apachectl restart
That always does not solve the problem.
Even then, try your CI installation in the normal mode after that. (With everything in normal mode: htaccess as before, and no index.php in the URL)
If it does not work, you may need to alter the apache config file httpd.conf
Try to search for this line:
#LoadModule rewrite_module modules/mod_rewrite.so
Uncomment it by removing the # sign
Restart Apache Server.
Test it now, again.
There could still be other things that you could do to enable mod_rewrite.

Magento Godaddy No file input specified

I have Linux webhosting on Godaddy. I tried installing Magento CE 1.8 on subdomain for more than a week and I still cannot get it to work.
Before you say this question is duplicit, I have tried everything I found on Magento Wiki, Forums, Google and Godaddy forum and support and I still cannot get it to work.
For php5.ini I take Magento php.ini.sample, .htaccess is from Magento too.
Using Options -MultiViews in .htaccess usually doesn't do anything.
Settings cgi.fix_pathinfo = 1 in php5.ini creates cyclic redirect.
I have tried playing with RewriteBase in .htaccess and that didnt help either.
I read that Magento doesnt run on fcgi, so I use in my .htaccess, doesnt help either:
Options +ExecCGI
addhandler x-httpd-php5-cgi .php
I always end up with "No file input specified" or cyclic redirect or server error.
Only lines in error log that I see are added:
[Thu Oct 31 01:23:08 2013] [11988011] [negotiation:error] [client 5.178.58.85:65433] AH00687: Negotiation: discovered file(s) matching request: "path" (None could be negotiated).
But I dont know what that does mean or how to fix that.
So is there anything else I can try or am I missing something? I know Magento on Godaddy shared hosting isnt a good idea, but I need to get there my development running and production will run on my clients Dedicated server.
Add this to your .htaccess file and forgot those other fixes....
RewriteRule ^index.php/(.*)$ [L]
If magento lies in a subdirectory then use:
RewriteRule ^index.php/admin(.*) {RewriteBase}/admin$1 [L]
So I managed to solve it after few weeks of trying different solutions on net and trying to get support to help me.
Nothing helped solve it so I tried myself and found out that the problem is "index.php" in url. So I have created simple php function which is run in at the beginning of index.php file. This function removes "index.php/" from url and redirects to this new url.
Also to remove "index.php" from form actions and other places where the url might show up, it is good to create your own router module or modify Magentos router.
Now it all works.
PS:
I have also kept other fixes in place:
In .htaccess:
Options +ExecCGI
AddHandler x-httpd-php5-cgi .php
AddHandler x-httpd-php5-cgi .php5
Options -MultiViews
RewriteBase /
And in php5.ini
cgi.fix_pathinfo = 1
EDIT
What I wrote does work, but is not good solution, redirect in index.php loses all POST data ofcourse. And looking at Magento and changing router takes too much work, so in the end I managed to create working rule in .htaccess for admin. Just put it as last rewrite rule in your .htaccess:
RewriteRule ^index.php/admin(.*) /admin$1 [L]
EDIT
Forgot to write here, that I have changed the rewrite to this:
RewriteRule ^index.php/(.*) /$1 [L]

URL working in local but not in production

I am developing website in magento. I tested it in local and it works fine.
Then i pushed my code into production but it's not working up in there.
It shows me "cms-index-noroute-". I wanted to debug So I deleted copy from my local and copied all the files using ftp from production. But still it works into my local but not working into production server.
Don't know what the problem.
Let me know if you can think of any reason why it's not working..
Any Help would appreciated.
It seems like you are getting 404 error. Did you got the 404 error on all page except the home page ..?If yes, please try to load your page like http://yoursiteurl.com/index.php/anypage.html .Try to add index.php like above I mentioned. Now your page load correctly then, you need to modify your .htaccess file in your root directory. open your .htaccess file and search for the following RewriteBase . Modify your RewriteBase like this.
RewriteBase /yoursitename/ or RewriteBase /

How do i do a mod_rewrite in xampp localhost in a sub directory?

I'm a complete newbie to htaccess and I'm having a problem getting the mod_rewrite to work.
I'm trying to change the below:
http://localhost/login/sitepage.php?linklabel=editted
to
http://localhost/login/sitepage/editted
I've looked at loads of solutions online and none of them work. I've used phpinfo() and mod_rewrite is loaded and I've been able to direct the users to a 404.php file with the htaccess file.
any help would be great thanks**
hey guys sorry for the bother there wasn't actually a problem it was just me being really dumb. I misunderstood what mod_rewrite actually did in that i thought it rewrote the url in the bar when you clicked on a link that displays the query in the url bar.
For anyone who has came across the same problem here's the problem and solution:
i wanted this /sitepage.php?linklabel=editted to change to /editted.html
anyway using the code generator at http://www.generateit.net/mod-rewrite/ , in the .htaccess file i put the follwing code -
RewriteEngine On
RewriteRule ^([^/]*).html$ /sitepage.php?linklabel=$1 [L]
When i clicked the button it still went to /sitepage.php?linklabel=editted
I forgot to change editted page
to
editted page because it displays the content from the /sitepage.php?linklabel=editted page in the new url.

Codeigniter: Routes only visible when entering /index segments

I'm working on my first project with codeigniter 2.0 and have a bit of a problem.
On my localhost (a MAMP installation) everything works fine with the routes. Only when i add a copy on my domain, change the base url and other necessary settings like my database settings it works fine for like 99%. I can't access my other controllers directly without adding the /index route. For example when i want to visit the http://my_domain.com/work it'll open the 404 error page but when i enter ttp://my_domain.com/work/index it works fine. Does someone know a setting i have to change for the online version? The Htaccess files are identical.
CHeers in advance.
I found my solution. I just checked the routes.php file in my config where i added a route for every controller. I just removed these and only my default_controller route is left. Now it works fine. Just a codeigniter newbie issue.
Thanks anyways for the help #Hibiscus and #BigFatBaby
I sorted my problem by setting the following line as my .htaccess file.
RewriteEngine On
RewriteRule ^.*$ index.php [NC,L]
It'll rewrite anything after the /index.php/blaha to /blaha.

Resources