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
Related
I have just managed to install Akeneo 2.3 and have managed to get to the login screen where I have entered the default credentials (both app and app_dev).
Unfortunately all I now get is "Loading...." with dinosaurs being dropped into boxes.
Nothing appears to be reported in the either log files that is of any value (although I may not realise the importance of some entries). The only 'error' which is reported as not being caught is that for some reason the favicon cannot be found although it is in the root of the webspace.....makes be wonder whether there is an issues with routing or permissions.
Other than that I haven't got any idea, nor do I really know where to start to find a solution. Anybody got any pointers on what I can do to try and start debugging the problem?
I have previously been running version 1.8 as a prototype successfully. Now moving to a later version, I have found a lot has changed....and am stuck. Any help would be appreciated.
THanks.
I spotted the problem and now resolved it.
Digging in with the developer tools in Chrome, it was showing a 404 error for some AJAX calls. But it also showed that the js file that was causing the error then provided a hint that the webserver wasn't configured correctly and that maybe mod_rewrite wasn't running properly.
Long story short, ensure AllowOverride is set within your folder structure.
<Directory /var/www/html>
AllowOverride All
</Directory>
Restart Apache and problem is resolved.
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.
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.
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
I recently migrated my magento website to a different server, and here's the process I used:
made a dump of the database.
copied all the system files from the FTP to my hard drive.
emptied the VAR folder
emptied the media cache folders
replaced the strings in the SQL dump from http://www.oldsite.com to http://www.newsite.com
restored the database on the new server
modified the local.xml file to suit the new database host, login and password.
uploaded the system files to the new server
Everything seems to work fine, except for the fact that the product images are not being displayed on the frontend for some reason.
For example, here's a path from an image that was supposed to be showing, which I got through firebug:
http://www.newsite.com/media/catalog/product/cache/1/small_image/113x113/9df78eab33525d08d6e5fb8d27136e95/1/_/1_9.jpg
When I search for the path of the image the site is supposed to show in the FTP, the file is actually there. I can download it and display it on my computer. I don't know why this is happening. It doesn't make any sense to me.
This /media/catalog/product/cache/ was generated by the system, because I erased it myself before uploading the site, so I guess it isn't a cache related issue.
Well, I described the issue the best I could. I hope you can help me out.
EDIT:
Hmm, it turns out the problem was the .htaccess file inside the media folder! Removed the file -> Problem solved!
Just in case anyone else has the same problem, removing the .htaccess in the media folder did the trick. I don't know if that's the best possible solution though! Thanks!
Change Options All -Indexes to Options -Indexes in the above mentioned .htaccess file.
copied all the system files from the FTP to my hard drive.
This one makes me a bit suspecting. Magento has case-sensitive folders in the media folder. There would be, for instance, an 'a' folder and an 'A' folder in the same location.
If you downloaded your files unarchived (file by file) via FTP to a Windows machine, this would cause a conflict and would omit up to half your images.
Ok, since everything checked out with the base URL, my next suggestion is a migration path option if you have cPanel on the old server, and since most do, this should help:
Create a full backup of the account using cPanel. This will create a tar.gz of the entire account.
Download the tarred backup to your computer and unzip.
Find home_dir.tar - this is what contains your HTML root information. You can either upload this directly to the server and untar there using SSH, or do it on your local computer and upload.
Find the SQL folder in the untarred backup. There should be a dump of your database there. Use source to put that information into a new database.
On the server, delete use_cache.ser and change config information for the new database.
Your .htaccess should have come over in the home_dir.tar, but make sure that it's correct per our other question
Once that's done, you should be fully functional, unless you need to make changes in the database base_url for the new server.
Images not showing in Magento 1.7 to 1.9 upgrade:
My solution:
in /media/.htaccess
fixed options syntax:
# Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes
removed these. Maybe conflict with .htaccess in site root directory??
# For security reasons, Option followsymlinks cannot be overridden.
# Options +FollowSymLinks
# Options +SymLinksIfOwnerMatch
# RewriteEngie on
also changed ownership of .htaccess to apache
chown apache:apache /var/www/mystore/media/.htaccess
Would like opinion of why these may be causing 500 errors.
php bin/magento catalog:images:resize
This helped me, but it take's a lot of time to complete
for magento 2.4.5
in pub//media/.htaccess
change „FollowSymLinks“ to „SymLinksIfOwnerMatch“. example:
############################################
enable rewrites
Options +SymLinksIfOwnerMatch
RewriteEngine on
## you can put here your pub/media folder path relative to web root
#RewriteBase /magento/pub/media/
############################################