ameliehub Posted October 4, 2012 Share Posted October 4, 2012 Hello, My links are not working proparly I've read all the other similar posts on the forum but could note find the solution. In the header page I've changed the links for css and images link href="css/style.css" retriving the / before css/style It's working now well But for the navigation <li><a href="/shop/coffee/">Coffee</a></li> The links won't work even when I do: <li><a href="shop/coffee/">Coffee</a></li> I figure it has something to do with htaccess? Sorry if my post in not that clear hard to explain in english... Link to comment Share on other sites More sharing options...
ameliehub Posted October 4, 2012 Author Share Posted October 4, 2012 More precision on my last post: Config.inc.php define ('BASE_URI', '/wampserveur/www/coffee/'); I'm working on localhost for the moment The htaccess is in the root directory (coffee). I've modifyed the htacess for test according to the topic of 6th sept 2011, http://localhost/coffee/test/ but it I get the same message: "The requested URL /coffee/test/ was not found on this server" I think there must be a problem in the organisation of my directories. Link to comment Share on other sites More sharing options...
Larry Posted October 5, 2012 Share Posted October 5, 2012 If your site is within the coffee directory, then your links must begin with /coffee. And your .htaccess must account for the coffee directory, too. Link to comment Share on other sites More sharing options...
ameliehub Posted October 5, 2012 Author Share Posted October 5, 2012 thank you for your reply. Yes my site is in the coffee directory I've added /coffee for the link Exemple on the home.html <a href="/coffee/shop/sales/">Sale Items</a> and <a href="/coffee/shop/sales/#' htaccess: <IfModule mod_rewrite.c> RewriteEngine on # For sales: RewriteRule ^/coffee/shop/sales/?$ sales.php # For the primary categories: RewriteRule ^/coffee/shop/([A-Za-z\+]+)/?$ shop.php?type=$1 # For specific products: RewriteRule ^/coffee/browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3 .... But still not working. Thank you very much for you help. Link to comment Share on other sites More sharing options...
Larry Posted October 5, 2012 Share Posted October 5, 2012 HOW is it not working? Link to comment Share on other sites More sharing options...
ameliehub Posted October 6, 2012 Author Share Posted October 6, 2012 I will try to be more precise. I am not familiar with htaccess. But I've understood what it does with the explaination in the book. The links of the navigation in index.php and the ones in shop.php are not working meaning I get this message For index.php The requested URL /shop/coffee/ was not found on this server. Here are my links in header.html <!-- MENU --> <li><a href="/shop/coffee/">Coffee</a></li>... For shop.php The requested URL /coffee/browse/coffee/Dark+Roast/2 was not found on this server. Links in : list_categories.html <a href="browse/' . $type . '/' . urlencode($row['category']) . '/' . $row['id'] . '" class="h4">View All ' . $row['category'] . ' Products</a></p></li>'; I've changed the path with the directories in the pages and htaccess but I always get those messages. I'm sure it's a question of path, but I can't find the right one. Thank you very much for your help. Link to comment Share on other sites More sharing options...
Larry Posted October 6, 2012 Share Posted October 6, 2012 Well, as I said before, all your links and references must begin with "coffee" since the site is within the "coffee" directory. Once you've consistently done that, then you can approach the .htaccess issues. Link to comment Share on other sites More sharing options...
ameliehub Posted October 6, 2012 Author Share Posted October 6, 2012 OK I've put coffee in front of all my links. header.html: <!-- MENU --> <li><a href="coffee/shop/coffee/">Coffee</a></li> <li><a href="coffee/shop/goodies/">Goodies</a></li> category-list.html: <a href="coffee/browse/' . $type . '/' . urlencode($row['category']) . '/' . $row['id'] . '" class="h4">View All ' . $row['category'] . ' Products</a></p> For Htaccess, I've put as well coffee <IfModule mod_rewrite.c> RewriteEngine on # For sales: RewriteRule ^coffee/shop/sales/?$ sales.php # For the primary categories: RewriteRule ^coffee/shop/([A-Za-z\+]+)/?$ shop.php?type=$1 # For specific products: RewriteRule ^coffee/browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3 # For HTTPS pages: RewriteCond %{HTTPS} off RewriteRule ^coffee/(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> I've tried the links index.php The requested URL /coffee/shop/coffee/ was not found on this server. shop.php The requested URL /coffee/coffee/browse/coffee/Dark+Roast/2 was not found on this server. (I've tried also the links with the htaccess at it was but I get the same messages on the URL not found) I'm sorry to take so much of your time. But I've been working so much to solve the problem, I would really like to find the solution Thank you very much for your help Link to comment Share on other sites More sharing options...
Larry Posted October 8, 2012 Share Posted October 8, 2012 That's not going to work. You need to make absolute paths, which means you need to put /coffee in front of all of your links. Link to comment Share on other sites More sharing options...
ameliehub Posted October 8, 2012 Author Share Posted October 8, 2012 I've made some progress... the links of the menu in index.php and shop.php are working but not those inside each categories Should it be a pb with the link in list_categories.html <a href="/coffee/browse/' . $type . '/' . urlencode($row['category']) . '/' . $row['id'] . '" class="h4">View All ' . $row['category'] . ' Products</a></p> Also in header.html, links won't work with <!-- MENU --> <li><a href="/coffee/shop/coffee/">Coffee</a></li> <li><a href="/coffee/shop/goodies/">Goodies</a></li> But works: <li><a href="coffee/shop/coffee/">Coffee</a></li> What about htaccess <IfModule mod_rewrite.c> RewriteEngine on # For sales: RewriteRule ^coffee/shop/sales/?$ sales.php # For the primary categories: RewriteRule ^coffee/shop/([A-Za-z\+]+)/?$ shop.php?type=$1 # For specific products: RewriteRule ^coffee/browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3 # For HTTPS pages: RewriteCond %{HTTPS} off RewriteRule ^coffee/(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> Is this correct? Thanks a lot Link to comment Share on other sites More sharing options...
Larry Posted October 8, 2012 Share Posted October 8, 2012 Again, what does "won't work" mean? Regardless of what you're seeing, if you're using the www/coffee for your files, and therefore http://localhost/coffee as the base URL, then all links and references to images, CSS, and JS in your HTML must begin with /coffee. Trust me on this. Link to comment Share on other sites More sharing options...
ameliehub Posted October 8, 2012 Author Share Posted October 8, 2012 OK Larry, I've managed to make ALL my links work. I sooooooo glad!!! But I just don't understand home.html <li><a href="/coffee/coffee/shop/coffee/">Coffee</a></li> List_categories.html <a href="/coffee/coffee/browse/' . $type . '/' . urlencode($row['category']) . '/' . $row['id'] . '" class="h4">View All ' . $row['category'] . ' Products</a></p> I've doubles type coffee. Why? I have unfortunatly an other pb that has been already discussed on the forum but could not find the solution through it. For cart.php and whishlist.php, I get this message: "An error occurred in script 'C:\wampserveur\www\coffee\cart.php' on line 81: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array" ligne 81 in shop.php if (mysqli_num_rows($r) > 0) { // Products to show! Same message for whislist What can I do about that? Thank again for your time Link to comment Share on other sites More sharing options...
Larry Posted October 8, 2012 Share Posted October 8, 2012 I don't know why you doubled up "coffee" in those links. Shouldn't work at all, given the other information provided. As for your other problem, since that's a new and different problem, post it in a new thread. 1 Link to comment Share on other sites More sharing options...
saif Posted January 26, 2013 Share Posted January 26, 2013 recently I bought the book effortless ecommerce and downloaded the code for ex2(coffee shop) from online. I am using apache 2.2.22 with php 5+ and my sql 5+. folder i put in c:\wamp\www\ex2 and inside ex2\my sql.inc and rest inside ex2\html\ . I tried to run it from localhost but not working at all. please help me with this. Thanks Link to comment Share on other sites More sharing options...
margaux Posted January 26, 2013 Share Posted January 26, 2013 What does not working mean? Do you get any error messages? If you've only downloaded the files it won't work. You need to set up the database and modify the configuration files for your set up. Have you read any of the book? Sorry for these questions but your post actually gives very little information on which to reply. Link to comment Share on other sites More sharing options...
saif Posted January 27, 2013 Share Posted January 27, 2013 Hi margaux, Thanks for asking. I have changed config.inc to below, mainly none of links are working.when I click it is giving following error (Not Found The requested URL /shop/sales/ was not found on this server.) // Determine location of files and the URL of the site: define ('BASE_URI', 'c:/wamp/www/ex2/'); define ('BASE_URL', 'http://localhost/'); define ('MYSQL', BASE_URI . 'mysql.inc.php'); Link to comment Share on other sites More sharing options...
saif Posted January 27, 2013 Share Posted January 27, 2013 Hi margaux, Thanks for asking. I have changed config.inc to below, mainly none of links are working.when I click it is giving following error (Not Found The requested URL /shop/sales/ was not found on this server.) // Determine location of files and the URL of the site: define ('BASE_URI', 'c:/wamp/www/ex2/'); define ('BASE_URL', 'http://localhost/'); define ('MYSQL', BASE_URI . 'mysql.inc.php'); now home page is showing but when i click on wish list or cart it is giving following error message An error occurred in script 'C:\wamp\www\ex2\html\wishlist.php' on line 80: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array please help me with this. thanks Link to comment Share on other sites More sharing options...
margaux Posted January 27, 2013 Share Posted January 27, 2013 These kind of errors require some basic debugging and the error messages give you a good indication of what is causing the problem. In the first case, the files are not in the folders that are being pointed to. Either relocate the files or change the path. In the second case, its usually because there is an error in the mysql query. Run the query directly in something like phpmyadmin and you should get a helpful response. Usually if you cut and paste the error response in google you'll find loads of similar questions with possible solutions to try. Link to comment Share on other sites More sharing options...
saif Posted January 27, 2013 Share Posted January 27, 2013 Thanks margaux. I am gonna try tonight. Anyway since yesterday i progress a lot. Hopefully I'll figure out the actual problem. Link to comment Share on other sites More sharing options...
saif Posted January 27, 2013 Share Posted January 27, 2013 OK Larry, I've managed to make ALL my links work. I sooooooo glad!!! But I just don't understand home.html <li><a href="/coffee/coffee/shop/coffee/">Coffee</a></li> List_categories.html <a href="/coffee/coffee/browse/' . $type . '/' . urlencode($row['category']) . '/' . $row['id'] . '" class="h4">View All ' . $row['category'] . ' Products</a></p> I've doubles type coffee. Why? I have unfortunatly an other pb that has been already discussed on the forum but could not find the solution through it. For cart.php and whishlist.php, I get this message: "An error occurred in script 'C:\wampserveur\www\coffee\cart.php' on line 81: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array" ligne 81 in shop.php if (mysqli_num_rows($r) > 0) { // Products to show! Same message for whislist What can I do about that? Thank again for your time hi ameliehub, please can you explain how did you make those link working /shop/sales/ ? because I am facing same issue. because there are no folder call shop. please let me know .thanks Link to comment Share on other sites More sharing options...
Larry Posted January 28, 2013 Share Posted January 28, 2013 You need to setup the mod_rewite rules. By the way, this book assumes complete comfort with PHP & MySQL. It does not teach those technologies. If you aren't already comfortable with both, you're going to have a hard time. Link to comment Share on other sites More sharing options...
saif Posted January 28, 2013 Share Posted January 28, 2013 Thank you for your reply. Could you please tell me where from can I get help for this? Link to comment Share on other sites More sharing options...
Larry Posted January 28, 2013 Share Posted January 28, 2013 Get help for what? Link to comment Share on other sites More sharing options...
saif Posted January 28, 2013 Share Posted January 28, 2013 mod_rewrite Link to comment Share on other sites More sharing options...
saif Posted January 28, 2013 Share Posted January 28, 2013 <IfModule mod_rewrite.c> RewriteEngine on # For sales: RewriteRule ^/ex2/shop/sales/?$ sales.php # For the primary categories: RewriteRule ^/ex2/shop/([A-Za-z\+]+)/?$ shop.php?type=$1 # For specific products: RewriteRule ^/ex2/browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3 # For HTTPS pages: RewriteCond %{HTTPS} off RewriteRule ^/ex2/(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L] %{HTTP_HOST} </IfModule> Link to comment Share on other sites More sharing options...
Recommended Posts