![]() |
|
#1
|
|||
|
|||
Need rewrite help for cgi script Shop cartI'm trying to take this and make it basically look like directories for starters:
http://www.xxxxxxxx.com/shop/cgi-bin/cp-app.cgi?usr=51F6296048&rnd=8879364&rrc=N&affl=&cip =&act=&aff=&pg=prod&ref=SS-JETEPHS008029&cat=&catstr= Using this: Options +FollowSymLinks RewriteEngine on RewriteBase /prod RewriteRule cp-app/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/$ /\/shop/cgi-bin/cp-app\.cgi?$1=$2&$3=$4&$5=$6&$7=$8&$9=$10&$11=$12&$1 3=$14&$15=$16&$17=$18&$19=$20&$21=$22 But it's not working. Being a novice at this.....if I can make it all directories, my next move would be to have someone help me shrink it down to just 2 variables for search engine friendliness. But I can't seem to make it work even into a long directory string. Also, once I shrink it down do you recommend ending in something like /prod/SS-JETEPHS008029/51F6296048- with no file name or use the product number as a file like /SS-JETEPHS008029.html ???? This is all new to me and I could use someones help looking at the rule above. Thanks!!!! |
|||
|
#2
|
||||
|
||||
|
Now, I don't know if the code you posted was 'modified' by this forum script (since I have just upgraded the forums) but this search pattern is not right:
Code:
What that means is that the rule should match 0 or more dots! What your pattern should look like is this: Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
ok here is the url I'm trying to rewrite as all directories:
http://www.itsalreadysigned4u.com/shop/cgi-bin/cp-app.cgi?usr=51F9431182&rnd=5224483&rrc=N&affl=&cip =65.32.153.69&act=&aff=&pg=prod&ref=SS-JETEPHS008029&cat=&catstr= Below is the code used in .htaccess as I've changed to what you stated: Options +FollowSymLinks RewriteEngine on RewriteRule cp-app/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/$ /\/shop/cgi-bin/cp-app\.cgi?$1=$2&$3=$4&$5=$6&$7=$8&$9=$10&$11=$12&$1 3=$14&$15=$16&$17=$18&$19=$20&$21=$22 Can you look carefully at this and tell me if this is now correct thru and thru? Once I've successfully gotten it to write all as directories I'll want to remove some of the variables and shrink it down, but I need to make this work right? Is my rule above correct? Quote:
|
|
#4
|
||||
|
||||
|
Okay, here are a few fixes that I think you should address:
Code:
should be Code:
Then, this part: Code:
could just be Code:
So a sample of this rewrite rule could now look like this: Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
|||
|
|||
|
ok this is what I have....
Options +FollowSymLinks RewriteEngine on RewriteRule cp-app/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/$ shop/cgi-bin/cp-app.cgi?usr=$1&rnd=$2&rrc=$3&affl=$4&cip=$5&act=$6 &aff=$7&pg=$8&ref=$9&cat=$10&catstr=$11 But for some reason I'm still getting no change in the url. Quote:
|
|
#6
|
||||
|
||||
|
Quote:
Also, how do the links appear on your web pages now, if looking at your website, they have not been changed yet, so it's hard to say what's wrong. Why don't you create a test page and upload it to your live server with a little less variables in your query string; just until you understand how all this works? For example you could write a simple PHP page, filename it test.php, then insert the following code: PHP Code:
Append the rewrite rule below to your existing .htaccess file and upload it too: Code:
Now in your browser's address bar, type: http://www.itsalreadysigned4u.com/test/article/1/en/ hit ENTER and see what happens... __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#7
|
|||
|
|||
|
ok it returns this:
Array ( [type] => article [pg] => 1 [lang] => en ) Which I'm assuming is what you wanted? Quote:
|
|
#8
|
|||
|
|||
|
This is how a current product url looks that I'm trying to rewrite and shorten:
http://www.itsalreadysigned4u.com/shop/cgi-bin/cp-app.cgi?usr=51F9431182&rnd=6263554&rrc=N&affl=&cip =65.32.153.69&act=&aff=&pg=prod&ref=SS-JETEPHS008029&cat=&catstr= Here is current rule based on your suggestions: Options +FollowSymLinks RewriteEngine on RewriteRule ^cp-app/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/$ shop/cgi-bin/cp-app.cgi?usr=$1&rnd=$2&rrc=$3&affl=$4&cip=$5&act=$6 &aff=$7&pg=$8&ref=$9&cat=$10&catstr=$11 [L] |
|
#9
|
|||
|
|||
|
Hello, JDS, hope you had a great holiday. Can you look at my above post and continue our discussion please?
|
|
#10
|
||||
|
||||
|
I assumed the discussion was over since all you have to do now is to change all the links on your web pages to look like this... for example:
HTML Code:
I don't know how it should be handling "blank" variables so I simply added "NULL" just so that the URLS don't look awkward in a browser's address bar. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The