Forum Moderators: phranque

Message Too Old, No Replies

rewrite works but doesn't work

         

cybermatrix

12:08 pm on Jan 28, 2005 (gmt 0)

10+ Year Member



I created this rule and if you put the rewritten url in the address bar it works. However, if you are on the site and click the product link the new URL does not show up in the address bar it shows the url that the cart generates.

Any idea of why it is not working on the site?

Here is the rule
Options +FollowSymLinks
RewriteEngine on
RewriteRule 003store/(.*)/(.*)/(.*)/(.*)/$ /cgi-bin/003store.cgi?$1=$2&$3=$4

RonPK

1:05 pm on Jan 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just to make things clear: what does the product link look like?

003store/(.*)/(.*)/(.*)/(.*)/$

or

/cgi-bin/003store.cgi?$1=$2&$3=$4

?

Rumbas

1:11 pm on Jan 28, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Have you changed the URL's in your templates? I mean, are hard coding any URL's anywhere that you might have forgotten to change?

cybermatrix

1:36 pm on Jan 28, 2005 (gmt 0)

10+ Year Member



Here is how the URL looks in the address bar - with maydomainstore.com being replaced by the actual domain.

mydomainstore.com/cgi-bin/003store.cgi?user_action=custom_detail&catalogno=2482%2022

No,I have have not changed any URL in the templates they are not absolute URLS they all are like this /cgi-bin/003store.cgi?user_action=custom_detail&catalogno=%%catalogno%%

Birdman

2:31 pm on Jan 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, that's a common misconception. Many think that you can use mod_rewrite to instantly change a bad URL to a good one.

Actually, it's the opposite. You need to change the links in your templates to reflect the good. Then mod_rewrite silently flips it back top the bad URL, which is needed by the script.

Hope it helps some.

RonPK

2:36 pm on Jan 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The usual purpose of rewriting URLs is to have nice URLs secretly point to ugly ones. mod_rewrite only handles requests for pages. It does not change the URLs you use on your pages: you will need to modify them by hand or in your template.

BTW: welcome to WebmasterWorld, cybermatrix.

[added: Birdman beat me again...]