Run a CodeIgniter project issue - codeigniter

I am new to CodeIgniter, I have a project named task_board.
everything is OK. However when I typed localhost/task_board in browser, the following page is opened:
When I clicked on the highlighted project, following page is opened:
localhost without project is looked like:

I think you need to enable rewrite module - please follow these steps
1) Open apache’s configuration file using - {wamp_dir}/apache/conf/httpd.conf
2) Search for the following string:
LoadModule rewrite_module modules/mod_rewrite.so
and uncomment it (remove the ‘#’ sign).
3) Now search for another string AllowOverride None and replace it by AllowOverride All
This will be on two places, so you will need to replace two times
Finally save the changes,
close your text editor and restart your apache server.
That’s all.
Please follow these steps and let me know if you have any issues.

Related

Images from website not working for server root

I am hosting multiple websites on the same server. Instead of uploading the (same) pictures for each website into individual folders, I would like to make ONE main folder on the server where all websites will get their image from, so I dont end up with duplicates.
I tried everything but cannot seem to get it working. Can anyone help me out?
Hosting on Ubuntu 16.04 with Apache2.
My host file:
Alias "/product-image" "/var/www/uploads"
<Directory /var/www/mysite.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
So basically what I want is when my SRC goes to:
mysite.com/product-image/ferrari/f1.jpg
it should be served from
/var/www/uploads/ferrari/f1.jpg
Tried multiple tutorials but nothing worked so far.
P.S. when I go to the url mysite.com/product-image I would expect to see my upload folder but I see nothing. Instead I get an error:
Not Found
The requested URL /product-image was not found on this server.
Apache/2.4.18 (Ubuntu) Server at bedrijfskledinggroothandel.nl Port 443
If you have your multiple websites set up as subdomains in your hosting (as I do), each website at run time can only see the files in or below its specific subdirectory - the hosting will put this layer of security in place.
If this is your own server, not externally hosted, the same may well apply but you may perhaps be able to override this element of the configuration (if you want to - to me, the reason for this security layer is to prevent users realising the stuff is in the same place and trying to take advantage of the fact in some way).
You could however get to what I think is your objective by putting a http (not file level) redirect in place (via .htaccess) so that the subdomain interpreted https://my-website.com/Images (or whatever) as https://www.my-main-domain.com/central-image-directory, which would do the trick I think.

How to enable module rewrite in Apache configuration

I'm trying to copy website made in Magento in my localhost and finished another steps:
copied whole website via flash drive,
import database from server,
change parameters for database in local.xml (post root for user and
empty field for password),
clear cache in Magento var folder,
change base_url value in database
When I try to open it in browser, Homepage looks ok, but any link in page give me Error 404 - Object not found. I can't access to admin panel. Anything what I type URL after localhost/nameOfMyProject, I get Error 404.
I have another Magento project in my localhost and they work correctly, but that I installed from fresh Magento installation and then add new themes for that.
Here is different situation. I need to add whole existing project from server in localhost. I can't add this website on same way, because developer who made it changed files into core section. Project is too big it's not possible at the moment to change that, so any way is to download whole project in localhost.
Does anyone has some suggestion what to do?
If you are using XAMPP or WAMP as your web server, you may face a common problem that is the rewrite module (mod_rewrite) does not work properly. It is because the rewrite module is not enabled by default in Apache’s configuration settings. But you can enable it manually by following some simple steps:
1- Open apache’s configuration file using your favorite text editor. The configuration file is generally located at:
{apache_dir}/conf/httpd.conf
If you are using XAMPP or WAMP package then you will find the file at:
{xampp_dir}/apache/conf/httpd.conf
{wamp_dir}/apache/conf/httpd.conf
2- Search for the following string:#LoadModule rewrite_module modules/mod_rewrite.so and uncomment it (remove the ‘#’ sign).
3- Now search for another string AllowOverride None and replace it by AllowOverride All
4- Finally save the changes, close your text editor and restart your apache server.

htaccess problems ("/file/" serves file.php)

I was starting to implement mod_rewrite rules on my site when I came across some weird behaviour. I removed my htaccess file for this test, to take it out of the equation.
My local dev site is at http://dev.mydomain.com and is a virtual host.
If I go to, eg "http://dev.mydomain.com/blog/", that folder doesn't exist, but apache finds a matching php file "blog.php" and instead displays that.
This only happens when there is a matching php file - when there isn't, eg "http://dev.mydomain.com/barfblurg/" I just get a 404.
It's like there are some extra mod_rewrites going on above where the site htaccess would be - that when /file/ couldn't be resolved, it searches for other matching files and instead serves this - but there are no other htaccess files that would have an effect, so this must presumably be a config thing? I can't see anything in the apache.conf or php.ini that would cause this behaviour.
(This also doesn't happen on my live host elsewhere, so it's definitely a config thing.)
Anyone point me to where to turn that behaviour off, because it's interfering with the url rewrites I want to do?
(Apache2, OSX, 10.10.5)
This behavior is due to enabling of option MultiViews.
Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php.
To turn this off use:
Options -MultiViews
at top of your .htaccess or in Apache config/vhost file.

Magento index page loads but 404 errors on all others

Currently I am struggling with the categories and products showing 404 errors when I navigate away from the working home page.
I was able to install Magento and I am using a copy of an existing working site. The purpose is to use this new site as my dev sandbox. I am using Magento 1.11. This is also a multiple store site.
Things I have tried:
Reindex the Catalog URL Rewrite, this unfortunately never completes.
To try and solve this I have deleted all the lock files and then I have also deleted all the entries in the core_url_rewrite table.
I have also changed the Base URL in the core_config_data table to my new URL.
Thank you in advance!
Just like Fiasco Labs said, you probably turned on URL Rewriting:
System -> Configuration -> General -> Web -> Search Engine Optimizations -> Use Server Rewrites but don't have mod_rewrite Installed/Enabled.
Either Install/Enable it on your host, or just turn the server rewrites off.
Another reason, if you HAVE mod_rewrite Installed/Enabled, you might be missing .htaccess file in your Magento root.
even with mod_rewrite enabled, the error can be a misconfiguration of apache. Have a look at etc/httpd/conf/httpd.conf file. Find the part where is defined (standard Apache config dir). You should find:
AllowOverride All
If there is a
AllowOverride None
Change it to All and the magic happens. Then restart Apache with:
sudo service httpd restart

Trouble hosting with CodeIgniter

I am a CI newbie. All this time i have been doing my recent projects on my localhost. I chose CodeIgniter and Doctrine as my database framework.
My local host specs are:
Windows 7
Wampserver 2.0
I also have rewrite_module enabled in my apache.
Right from the beginning everything was working fine with CI and Doctrine on my localhost. I managed to finish my project and was happily waiting to port my first project live and uploaded it to a subdirectory of my bluehost account.
Before transferring the files i changed the config.php and the database.php by filling the required values.
But after i uploaded my files(along with the .htaccess) to my hosting solution provider i could see nothing but the 404 error (This is from codeigniter class and not my hosting solutions page). I keep getting this. I tried multiple options but i am not able to figure what this is all about. I am sure the index.php is getting called and when it tries to route to the default controller (which is 'home' in my case) it fails for some reason.
The directory structure in my localhost
PathtoWamp->www->mysitefolder
The directory structure in my live site
public_html(this is my root folder)->mysitefolder
I could also see that rewrite_module has been enabled with my live server (Thats wat my hosting solution bluehost says and i guess this is true)
Since i am very well past the deadline, i am wondering for a solution. Kindly do let me know if any of you guys have any idea.
Thanks in advance.
Regards,
Ashok Srinivasan.
I found out the root of the problem. All this time it was not the .htaccess, not httpd.conf and not bluehost, it was not god not anyone but the real culprit was Mr.CodeIgniter.
If you look at the Router.php located inside system/libraries then you will find a line at number 88 where
$this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
if you notice at the end of the ternary they are forcing a strtolower operation on the controller name. I removed that method and simply let the original name be used at this point by changing the line to this.
$this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : $this->routes['default_controller'];
Ok but what is the big deal here? Yes this makes a lot of sense right now. My local server was wamp installed on Windows and my production server was hosted on an Unix box. Since it is very well known that Windows is a soft guy who does not mind much about case sensitivity but Unix is very particular on the contrary.
The controller names in my project were all in Capitalized mode, the real issue arised from here. Also i went to my routes.php lying in the application/config where i rectified issues of this perspective.
Finally i am able to host my site now. Thanks to all who had put their heads into this after reading my question.
Regards,
Ashok Srinivasan.
I had the same problem in your httpd.conf
you need to find a line like this
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
Change it to
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
Thats all it took for me

Resources