Thread: yet another question from the dummy of ABW :) |
|

March 6th, 2005, 06:20 PM
|
|
pph Expert!
Join Date: January 18th, 2005
Location: Edmonton Canada
Posts: 5,791
|
|
I am trying to get mod rewrite to work I have got it working all but for one thing.
If the URL (usually a product name) contains a "#" symbol like in "#9" the url will not work, (it works in the original . php script using the php formating) it works for everything apart from the "#" symbol is there any way to get this to work please?
Somebody told me about a rewrite log but as usual I have no idea what they are talking about
Quote:
the rewriteLog says
args=ip=Scientific+Angler+Fishing+Fly+Rod+Salt+water+-+9+2+Piece+#10+Weight
but its lost somewhere... everything followed by a % is lost...
|
I've done a work around by changing the "#" to "no" but I would prefer the "#" if it is at all possible.
This is the rule I am using for it at present.
RewriteRule ^([^/_]+)\.htm /?ip=$1 [L]
thanks in advance for any help.
__________________
One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
Mr. Spitzer is fetching it nearer
YouTrek
|

March 6th, 2005, 06:54 PM
|
|
Resident Genius and Staunch Capitalist
Join Date: January 18th, 2005
Location: Florida
Posts: 12,826
|
|
N/m, I was going to say just make it say "no" instead but I see you're already doing that...
__________________
There is no knowledge that is not power. ~Hemingway
Digital Scales
|

March 6th, 2005, 06:56 PM
|
|
pph Expert!
Join Date: January 18th, 2005
Location: Edmonton Canada
Posts: 5,791
|
|
 Leader I might look daft but I'm not 100% daft LOL
__________________
One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
Mr. Spitzer is fetching it nearer
YouTrek
|

March 6th, 2005, 11:13 PM
|
|
Sgt. Joe Friday
Join Date: January 18th, 2005
Posts: 441
|
|
Just leave out the #. Any flyfisher (and most other anglers) will know what the weight relates to.
Frank
|

March 6th, 2005, 11:33 PM
|
|
Animal Lover
Join Date: January 18th, 2005
Location: oz
Posts: 1,212
|
|
Gordon
I'm not sure if this is right or not (I'm no mod rewrite expert)
You could always modify it in the url and then do a str_replace at the output end with another php script...so eg change it in the link to read
Scientific+Angler+Fishing+Fly+Rod+Salt+wat er+-+9+2+Piece+num10+Weight
and then on the page that receives the info, have a php script that says :
<? php
$ip=str_replace('num','#',$ip);
?>
Then it should read
Scientific+Angler+Fishing+Fly+Rod+Salt+wat er+-+9+2+Piece+#10+Weight
at the receiving end when you do call it.
Don't know if that's what you are after...my 2 cents. Someone with more mod rewrite experience could probably work a solution out for you
Oscar
|

March 7th, 2005, 02:58 PM
|
|
pph Expert!
Join Date: January 18th, 2005
Location: Edmonton Canada
Posts: 5,791
|
|
Thanks Oscar that is what I had done but I'm thinking in the future if I come across anther one then I'm screwed because as far as I know we can only use the str_replace for one change. If I'm wrong about this please let me know how to do it.
I was just hoping someone would know how to get around it with the mod rewrite then I would not have to go through all the sites I am going to use it on.
__________________
One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
Mr. Spitzer is fetching it nearer
YouTrek
|

March 7th, 2005, 03:24 PM
|
|
Not Verif-Lidated
Join Date: January 18th, 2005
Location: Sunny Florida
Posts: 1,028
|
|
(never mind, totally misread the problem)
__________________
Tim
consultant by day, affiliate by night
|

March 7th, 2005, 04:29 PM
|
|
Animal Lover
Join Date: January 18th, 2005
Location: oz
Posts: 1,212
|
|
Is this exactly what the rewrite log says?
Scientific+Angler+Fishing+Fly+Rod+Salt+wat er+-+9+2+Piece+#10+Weight
Why is there a blank in 'wat er'? That would translate to wat%20er and whenever I do rewrites I always take out spaces...
If it is the # that's causing the problem it could be that # in most urls read as 'bookmarks'? I don't know if it will work but maybe 'escape' the character with \#. I don't know if it will work - I've never used the exclude ^ before in my mod rewrites and I usually specify what I want in the string rather than what I don't want ie [A-Za-z0-9_\+\#]+
^([\#^/_]+)\.htm /?ip=$1 [L]
I hope it works for you but like I said, I'm not a mod expert...
Oscar
|

March 7th, 2005, 05:20 PM
|
|
pph Expert!
Join Date: January 18th, 2005
Location: Edmonton Canada
Posts: 5,791
|
|
Thanks anyway Oscar I cannot get it to work, maybe I'll have to stick with the way I am doing it now. I'ts not the best way but it works until I come across another symbol then I'm screwed LOL
__________________
One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
Mr. Spitzer is fetching it nearer
YouTrek
|

March 7th, 2005, 05:26 PM
|
|
Not Verif-Lidated
Join Date: January 18th, 2005
Location: Sunny Florida
Posts: 1,028
|
|
str_replace will take arrays, so you can do $ip = str_replace(array('foo','bar'), array('foof', 'barf'), $ip); etc. as needed if you find another symbol that's causing problems.
__________________
Tim
consultant by day, affiliate by night
|

March 7th, 2005, 05:53 PM
|
|
pph Expert!
Join Date: January 18th, 2005
Location: Edmonton Canada
Posts: 5,791
|
|
Thanks infospongellc I do mine like this
<? php print stripslashes(str_replace("xxxxxx","xxxxxx",$row["producturl"])); ?>
If I were to do this would it work do you know? or am I not doing it the way you mean?
<? php print stripslashes(str_replace(array('foo','bar'), array('foof', 'barf'),$row["producturl"])); ?>
oops I left my ID in LOL
__________________
One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
Mr. Spitzer is fetching it nearer
YouTrek
|

March 7th, 2005, 06:04 PM
|
|
Not Verif-Lidated
Join Date: January 18th, 2005
Location: Sunny Florida
Posts: 1,028
|
|
I think that's what you're after. It would change foo -> foof and bar -> barf in the product url string.
- Tim
__________________
Tim
consultant by day, affiliate by night
|

March 8th, 2005, 12:46 AM
|
|
pph Expert!
Join Date: January 18th, 2005
Location: Edmonton Canada
Posts: 5,791
|
|
That is a great bit of code infospogellc, I did not know you could use something like that to create more than one alteration. Thank you. That solves all my problems now if another wierd symbol comes up in the future.
__________________
One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
Mr. Spitzer is fetching it nearer
YouTrek
|
 |

Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|