Jump to content
Larry Ullman's Book Forums

.Htacess Configuration Problem


Recommended Posts

Dear larry

 

I am having a problem with .htaccess file settings.

 

my header file contains this link

 

<li><a href="/index.php">Home</a></li>
 <li><a href="/shop/goodies/">About Us</a></li>

 

the error shown when i click my home link is

 

The requested URL /index.php was not found on this server.

 

and my file is at wamp/www/ecommerce/ex2/shop

 

All files are included in shop folder(main folder)

 

 

and my htacsess file contains this code

 

<IfModule mod_rewrite.c>
RewriteEngine on
# For sales:
RewriteRule ^ecommerce/ex2/shop/sales/?$ sales.php
# For the primary categories:
RewriteRule ^ecommerce/ex2/shop/shop/([A-Za-z\+]+)/?$ shop.php?type=$1
# For specific products:
RewriteRule ^ecommerce/ex2/browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3
# For testing
RewriteRule ^ecommerce/ex2/eshop/(\d+)*$ index.php?id=$0
# For HTTPS pages:
RewriteCond %{HTTPS} off

</IfModule>

 

 

Please mention the problem with my links or htaccess settings.

I am not getting the logic behind the rewrite rule .Please explain it more to understand the real logic behind this code

 

^ecommerce/ex2/shop/sales/?$ sales.php

 

what the first part is doing and how our website understand all of these linkings.

 

 

Thanks alot.waiting for your response/

Link to comment
Share on other sites

You need to change your links so that they don't start with / but rather start with /ecommerce/ex2/ because that's part of the URL. The same goes for any CSS and JavaScript files that you include, and any image references.

Link to comment
Share on other sites

i have changed my link to

 

<li><a href="/ecommerce/ex2/index/">Home</a></li>
 <li><a href="/ecommerce/ex2/goodies/">About Us</a></li>

 

again i am getting the same error

 

The requested URL /ecommerce/ex2/index/ was not found on this server.              (error for home page)

The requested URL /ecommerce/ex2/goodies/ was not found on this server.          (error for about us)

 

my url shows this link http://localhost/ecommerce/ex2/index/ for index page and

for about us it shows http://localhost/ecommerce/ex2/goodies/

Link to comment
Share on other sites

Look at what your links were before and what they are in the book. It's not to index/ but to index.php. It's not to goodies/ but to shop/goodies. (Although you need to preface both with ecommerce/ex2/ as previously mentioned.

Link to comment
Share on other sites

Now after adding .php with index the home link starts working but the link <li><a href="ecommerce/ex2/shop/goodies/">About Us</a></li>

is not working.Showing this error

 

The requested URL ecommerce/ex2/shop/goodies/ was not found on this server.

 

I think it is not able to get goodies file.And tell me where is goodies file in the root folder.

Link to comment
Share on other sites

 Share

×
×
  • Create New...