The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 22, 2019, 07:29:28 PM

Login with username, password and session length


Pages: [1] 2 3
  Print  
Author Topic: .htaccess and trademark symbol !  (Read 23221 times)
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« on: September 12, 2009, 09:48:54 AM »

anyone knows how can I exclude this sign ® from my url ?

I'm thinking that this is possible with htaccess !

*But I want the anchor text to remain the same !

 Praise
Logged

what's up?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: September 12, 2009, 11:29:52 AM »

I don't get it NYD. Do you mean that some search phrase is coming in and you're getting that code on the URL?

But wouldn't you have put it there in the first place?

Very lost. 
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #2 on: September 12, 2009, 11:36:49 AM »

No perk Smiley

I've modified a CMS which is working with a datafeed !

So when I upload the datafeed .... the URL are generated automatically !

I want to put the trademark symbol on links but not on urls !

Example :
Name of product in my datafeed : Inspiron® 1510
and the url generated automatically would be : http://www.myexample.com/dell/Inspiron®-1510.html
The page title would be : Dell Inspiron® 1510
the description : Find the best price for Dell Inspiron® 1510 !
the h1 tage : Dell Inspiron® 1510

but I want to remove that sign from the URL that should be something like this : http://www.myexample.com/dell/Inspiron-1510.html

I hope I'm more clear now

 Nerd


Logged

what's up?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: September 12, 2009, 11:51:02 AM »

Please post the ORIGINAL UNCONVERTED Url here as you see it - wrap it in [ code ] like you would source code so that I can see it please.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #4 on: September 12, 2009, 11:57:16 AM »

Please post the ORIGINAL UNCONVERTED Url here as you see it - wrap it in [ code ] like you would source code so that I can see it please.

PM'ed to you !
Logged

what's up?
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #5 on: September 12, 2009, 12:28:40 PM »

you got my PM perk ?

 Cry
Logged

what's up?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: September 12, 2009, 12:31:56 PM »

hang tough ... getting some family biz sorted, be right there...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #7 on: September 12, 2009, 12:36:19 PM »

Thought it'd look like that.

$newURL = str_replace('%C2%AE', '', $inputURL);

That'll do ya. the %AE is the trademark, the C2 is a circumflex capital A, I don't know why that's in there, but you'll want to get rid of it as well.

another option would be to:

$newURL = preg_replace('/\%[0-9]{2}/', '', $inputURL) which would get rid of any chars like that in an input string.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #8 on: September 12, 2009, 12:40:08 PM »

hang tough ... getting some family biz sorted, be right there...
no problem ... family first

Thought it'd look like that.

$newURL = str_replace('%C2%AE', '', $inputURL);

That'll do ya. the %AE is the trademark, the C2 is a circumflex capital A, I don't know why that's in there, but you'll want to get rid of it as well.

another option would be to:

$newURL = preg_replace('/\%[0-9]{2}/', '', $inputURL) which would get rid of any chars like that in an input string.
I'll try that ... and comeback with the results

Thanks for your input perk  Wink
Logged

what's up?
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #9 on: September 12, 2009, 06:21:51 PM »

Thought it'd look like that.

$newURL = str_replace('%C2%AE', '', $inputURL);

That'll do ya. the %AE is the trademark, the C2 is a circumflex capital A, I don't know why that's in there, but you'll want to get rid of it as well.

another option would be to:

$newURL = preg_replace('/\%[0-9]{2}/', '', $inputURL) which would get rid of any chars like that in an input string.

perk, that regex would remove a % sign if followed by two digits 0-9, correct?

Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
deregular
Expert
****
Offline Offline

Posts: 172


View Profile
« Reply #10 on: September 12, 2009, 10:39:33 PM »

Wouldnt this sort of thing suffice? Allowing only alpha numeric through?

$string = preg_replace('#\W#','',$string);
« Last Edit: September 12, 2009, 10:43:52 PM by deregular » Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #11 on: September 13, 2009, 01:00:28 AM »

Wouldnt this sort of thing suffice? Allowing only alpha numeric through?

$string = preg_replace('#\W#','',$string);
He needs to ditch the hex code, in this case AE and 2C - literally, in the URL there is %2C%AE ... you want to ditch the actual 2C and AE.


perk, that regex would remove a % sign if followed by two digits 0-9, correct?
That's what it's supposed to do Bomps... did I get it wrong? AH ... I see it now... you are right bomps, I forgot to grab the hex part.

The command should actually be:
$cleanURL preg_replace('/\%[0-9A-F]{2}/i'''$inURL);

Thanks Bomps.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #12 on: September 13, 2009, 08:50:39 AM »

Well since I don't know fuck about regex .... i think i would not put the trademark symbol in my product name !

 Embarrassed

this code should be in .htaccess or in one of my class ?

 D'oh!  D'oh!  D'oh!
Logged

what's up?
deregular
Expert
****
Offline Offline

Posts: 172


View Profile
« Reply #13 on: September 13, 2009, 11:16:52 AM »

Quote
He needs to ditch the hex code, in this case AE and 2C - literally, in the URL there is %2C%AE ... you want to ditch the actual 2C and AE.
Gotcha, now i see where you were going with it.

NYDaz, it would go in one of your classes. As far as I know you cant run php code in .htaccess.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #14 on: September 13, 2009, 12:40:36 PM »

No... you can't do any such thing as I just demonstrated in .htaccess. I assumed you were already at a PHP level ... this could be my mistake ... I see everything through the lens of how I do things, which is to take ALL requests and funnel them into a single PHP process for handling... I apologize NYD.

This could be done with mod_rewrite though ... I THINK. I am not sure if the regex processor for mod_rewrite is strong enough - Dirk or Bompa would be better suited than me for this one.

Paging, Dirk and Bompa...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1] 2 3
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!