The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. February 12, 2012, 08:11:56 AM

Login with username, password and session length


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

Posts: 209


The night stalker


View Profile WWW
« Reply #15 on: September 13, 2009, 02:56:13 PM »

NYDaz, it would go in one of your classes. As far as I know you cant run php code in .htaccess.

thanks, deregular for your input !

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.

that's why I joined this forum ... to learn ... don't appologize to me perk  Smiley

let me see what i can do with this regex

 ROFLMAO

Paging, Dirk and Bompa...
Praise  Praise
Logged

I'm an educated fool, with money on my mind !
dirk
Global Moderator
Expert
*****
Offline Offline

Posts: 416


View Profile
« Reply #16 on: September 13, 2009, 03:08:36 PM »

With .htaccess and mod_rewrite you can change an "incoming" URL into another URL string.

But as I understand the URL which is generated when you upload the datafeed shall not include ®.

Hence the replacement should be done by this script, otherwise you would create invalid URLs.

Can't you include the replacement code into the script?

Dirk
Logged
NYDAz
Expert
****
Offline Offline

Posts: 209


The night stalker


View Profile WWW
« Reply #17 on: September 13, 2009, 03:18:08 PM »

I guess this is it

Code:
elseif ($format == "text") {
// remove html tags and decode entities
$decoded = html_entity_decode(strip_tags($value));
// remove excess white space
$excess = preg_replace("/^(\s+)/m", "", $decoded);
// replace new lines with spaces
$row[$column] = preg_replace("/([\\r\\n]+)/m", " ", $excess);
}
Logged

I'm an educated fool, with money on my mind !
dirk
Global Moderator
Expert
*****
Offline Offline

Posts: 416


View Profile
« Reply #18 on: September 13, 2009, 03:30:26 PM »

Could be the correct part of the script.

It's only a code snippet which you have posted hence I can't fully
understand it.

Ed mentioned this:

$cleanURL = preg_replace('/\%[0-9A-F]{2}/i', '', $inURL);

You should integrate it in your snippet, variable names have
to be adjusted, sure.
Logged
NYDAz
Expert
****
Offline Offline

Posts: 209


The night stalker


View Profile WWW
« Reply #19 on: September 13, 2009, 03:32:35 PM »

Thanks Mr.Fanto  Nerd

I'll do this shit ...
Logged

I'm an educated fool, with money on my mind !
dirk
Global Moderator
Expert
*****
Offline Offline

Posts: 416


View Profile
« Reply #20 on: September 13, 2009, 03:35:00 PM »

Yep, you're welcome.

Shoudn't be too complicated because the difficult part
is the regex which you already got from Ed.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 9792



View Profile
« Reply #21 on: September 13, 2009, 03:41:00 PM »

Thanks Dirk ... I thought it might need to be done in the htaccess, where you are Da Man.

Thanks for weighing in Smiley
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.
Bompa
Administrator
Lifer
*****
Online Online

Posts: 509


View Profile
« Reply #22 on: September 13, 2009, 04:17:03 PM »

Could be the correct part of the script.

It's only a code snippet which you have posted hence I can't fully
understand it.

 Ditto

This parts raises my eyebrows: "elseif ($format == "text") {"

Is there another elseif for URLs?


@perk, you were not "off" by suggesting a php change.  In his 2nd post he said that he had modified a CMS.



Logged

"Everything that can be counted does not necessarily count; everything that counts cannot necessarily be counted." -- Albert Einstein
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 9792



View Profile
« Reply #23 on: September 13, 2009, 04:18:57 PM »

 D'oh! I was off about being off  Roll Eyes
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: 209


The night stalker


View Profile WWW
« Reply #24 on: September 13, 2009, 04:36:36 PM »

 Roll Eyes I've managed to find my function

Code:
function MakeURLSafe($val)
{
$val = str_replace("-", "%2d", $val);
$val = str_replace("(", "", $val);
                $val = str_replace("®", "", $val);   <------------------------------------
$val = str_replace("+", "%2b", $val);
$val = str_replace("+", "%2b", $val);
$val = str_replace("/", "{47}", $val);
$val = str_replace("-", "%28", $val);
$val = urlencode($val);
$val = str_replace("+", "-", $val);
return $val;
}

All good ! The links are poiting to the URL without ® ! But when I click on the link i get a 404 !

And when I add a ® where it shoulded be, the page loads !

Need a break

 
Logged

I'm an educated fool, with money on my mind !
Bompa
Administrator
Lifer
*****
Online Online

Posts: 509


View Profile
« Reply #25 on: September 13, 2009, 04:45:11 PM »

The copyright symbol itself might not work in a regex.

Only you and perk have the original text, so it's up to you.

Cheesy


Quote
But when I click on the link i get a 404

Now that sounds like htaccess is doing something.

Not a simple problem, but you'll get it, just keep plugging away at it.


Bompa


« Last Edit: September 13, 2009, 04:49:17 PM by Bompa » Logged

"Everything that can be counted does not necessarily count; everything that counts cannot necessarily be counted." -- Albert Einstein
NYDAz
Expert
****
Offline Offline

Posts: 209


The night stalker


View Profile WWW
« Reply #26 on: September 13, 2009, 04:46:05 PM »

 ROFLMAO
Logged

I'm an educated fool, with money on my mind !
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 9792



View Profile
« Reply #27 on: September 13, 2009, 04:49:30 PM »

Here's a munge:

h++p // www . webproject . com/words%C2%AE-(Morewords)-And-some-more-words.html
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: 209


The night stalker


View Profile WWW
« Reply #28 on: September 13, 2009, 06:42:11 PM »

Another try

Code:
function MakeURLSafe($val1)
{
$val1 = str_replace("-", "%2d", $val1);
$val1 = str_replace("+", "%2b", $val1);
$val1 = str_replace("/", "{47}", $val1);
$val1 = urlencode($val1);
$val1 = str_replace("+", "-", $val1);
$val = str_replace('%C2%AE', '', $val1); <----------------------
return $val;
}

The links points to an unbelivale CLEAN url ... but again when I try to click .... 404 ..... Something went wrong

Here's my .htaccess

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]

Options -MultiViews +FollowSymlinks -Indexes

# Force 401 pages to use a valid error document
# so they do not fall back to the 404 which is
# triggered by ISC. This allows HTTP Auth to work
# correctly
ErrorDocument 401 "Unauthorized access"

<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off

# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
# If your server is running PHP in CGI mode you will probably need to uncomment the following lines
# Only uncomment lines that begine with Rewrite

# The RewriteBase should be set to the same value as the AppPath setting in your config.php WITH a / on the end
# RewriteBase /

# This rewrite base rule is only required if you are getting 401 unauthorized errors when placing an order with Google Checkout
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
<IfModule mod_env.c>
SetEnv SEO_SUPPORT 1
</IfModule>
</IfModule>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>

Any ideas ... because right now I'm so pissed

 Violin
« Last Edit: September 13, 2009, 06:45:38 PM by NYDAz » Logged

I'm an educated fool, with money on my mind !
Bompa
Administrator
Lifer
*****
Online Online

Posts: 509


View Profile
« Reply #29 on: September 13, 2009, 07:39:13 PM »

hmmm, I see no problem there.

I am wondering tho, when you add this datafeed, is it put into the CMS's database?

Cuz maybe the URLs are being saved in the db WITH the copyright symbol?

Maybe the modification you did is ONLY for the display and you need another for the db?

I'm sorta lost on this also.

Logged

"Everything that can be counted does not necessarily count; everything that counts cannot necessarily be counted." -- Albert Einstein
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!