Jump to content

Recommended Posts

Posted

I have a shopping cart that requires a url that looks like this:

 

****/cgi-bin/cart/cart.pl?db=goodies.txt&merchant=goodies&search=LucyNewItems

 

I'm trying to use Mod rewrite in the .htaccess file to make it more search engine friendly. Here's what I have:

 

RewriteEngine on

Options +FollowSymlinks

RewriteBase /

RewriteRule ^\.htaccess$ - [F]

RewriteRule ^(.*)store/(.*)$ $1cgi-bin/cart/cart.pl?db=goodies.txt&merchant=goodies&search=$2

 

Then on the html page, I've changed the link to:

 

****/store/LucyNewItems

 

If I understand what mod rewrite is supposed to do, it should take the new link format and translate it back to the form that the database requires so as to bring up the correct product page.

 

This isn't working. It produces a 404 file not found error. Can anyone tell me what I've done wrong and how to get this to work?

 

Thanks,

Miriam

Posted

I am very new at this, but It looks to me like you need to use

 

****/store/LucyNewItems.html

 

instead of

 

****/store/LucyNewItems

 

I think you need to all the .html

 

 

-gabe

Posted

Asking the obvious question...

 

You're definite http://****/cgi-bin/cart/cart.pl?db=goodies.txt&merchant=goodies&search=LucyNewItems is the correct location and it works when you go to it directly?

 

When I used this rule:

RewriteRule ^(.*)store/(.*)$ $1php/test/redtest.php?db=goodies.txt&merchant=goodies&search=$2

 

My little PHP test script runs and outputs:

Requested URL: /store/LucyNewItems

File actually served: /php/test/redtest.php

Arguments Passed: db=goodies.txt&merchant=goodies&search=LucyNewItems

Posted

Yes, using the correct domain:

 

"http://64.39.23.130/cgi-bin/cart/cart.pl?db=goodies.txt&merchant=goodies&search=LucyNewItems", if you put that in the url address, you will be taken to the product page.

 

Could you explain the test that you wrote so I could try it? Did you write in an .htaccess file? How did you run it to test it? Did your test show that this should have worked?

 

Thank you for your help...

Miriam

Posted

Yea. When I tested it, it seemed to work.

 

My .htaccess (made it similar to yours):

>RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^\.htaccess$ - [F]
RewriteRule ^(.*)store/(.*)$ $1php/test/redtest.php?db=goodies.txt&merchant=goodies&search=$2

 

The redtest.php file:

><?php
   print("Requested URL: ".$REQUEST_URI."<br>File actually served: ".$PHP_SELF."<br>Arguments Passed: ".$QUERY_STRING);
?>

 

When I request http://****/store/LucyNewItems the output I get is:

Requested URL: /store/LucyNewItems

File actually served: /php/test/redtest.php

Arguments Passed: db=goodies.txt&merchant=goodies&search=LucyNewItems

Posted

I'm studying your code and trying to understand it.... :) but not really understanding it at all :)

 

So if I wrote the code in the .htaccess file correctly, why isn't it working?

 

Sorry for being so dense.

 

Thanks,

Miriam

Posted

Unfortunately, no. Do you have anything else in your .htaccess file or is that all of it?

 

And also, just to cover the bases, this .htaccess file is located in your public_html directory, and is world readable (world has read permission enabled)?

Posted

Mike, just to let you know, I copied and pasted what you wrote into my .htaccess file, then changed to the correct path names...and it works! I couldn't see anything that I had typed differently that you, but there must have been something, 'cause it definitely liked what you typed better.

 

I have accomplished getting the pages to look like static url's. I'm now going to re-submit to the search engines and hope to get better placement.

 

Thanks so much for your help!

 

Miriam

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...