Unstoppable Domains

.htaccess

Spaceship Spaceship
Watch

tandiono

Tandiono.comEstablished Member
Impact
0
Is there anyway that i could change a certain words on my site,

example :
"dick head" to "praise the mighty lord" by .htaccess ?

so if any of "dick head" words were post it will be automatically change to "praise the mighty lord"


To anyone please kindly assist me. Thanks in advance :tu:
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Code:
RewriteEngine on
RewriteRule (.*)?dick(.*)?head(.*)? $1praise_the_mighty_lord$3 [R]
I'm not sure if you can use spaces in it which is why I allowed for anything inbetween dick head. If that doesn't work, tell me and I'll try harder. ;)
 
0
•••
Dan said:
Code:
RewriteEngine on
RewriteRule (.*)?dick(.*)?head(.*)? $1praise_the_mighty_lord$3 [R]
I'm not sure if you can use spaces in it which is why I allowed for anything inbetween dick head. If that doesn't work, tell me and I'll try harder. ;)


Thanks for the reply :)

well, just try it but not working. Is there any other way?
 
0
•••
I don't think .htaccess can do it, however, I know some forum software has the ability to do this with postings. I had a forum member keep spam posting a website in every post and I set the forum up to replace his website name with "I'm a spammer". After I while, I think he got the message.

You might do a search for a "search and replace" script and set it up as a cron job.

http://www.hotscripts.com/Tools_and_Utilities/File_Manipulation/Search_and_Replace/index.html
 
0
•••
AdoptableDomains said:
I don't think .htaccess can do it, however, I know some forum software has the ability to do this with postings. I had a forum member keep spam posting a website in every post and I set the forum up to replace his website name with "I'm a spammer". After I while, I think he got the message.

You might do a search for a "search and replace" script and set it up as a cron job.

http://www.hotscripts.com/Tools_and_Utilities/File_Manipulation/Search_and_Replace/index.html


well, can't find any source which could perform this action on hotscripts.com .. it's actually for my blog site, which i need to force change a certain words :music: looking if there are anyway which could force change words by .htaccess
 
0
•••
Code:
RewriteEngine on
RewriteRule (.*)?dick(.*)?head(.*)? $1praise_the_mighty_lord$3 [NC,R]
I tested that it replaces dick head with praise_the_mighty_lord and it worked. [I added the NC,]

If it goes to some crazy URL when it does it, show me the URL it goes to.
 
0
•••
Dan said:
Code:
RewriteEngine on
RewriteRule (.*)?dick(.*)?head(.*)? $1praise_the_mighty_lord$3 [NC,R]
I tested that it replaces dick head with praise_the_mighty_lord and it worked. [I added the NC,]

If it goes to some crazy URL when it does it, show me the URL it goes to.


just try it, but still not working either. Im trying it on the plain .htm file
 
0
•••
Can you show me where you are using it and what it goes to? I just tested it and it worked..

What are you trying on an HTML file??
 
0
•••
0
•••
0
•••
Dan he is trying to change the text on a page not the address of the page.

tandiono is the blog written in php? If so you could do something like the following on the output:-

PHP:
<?php
$users_string = 'This is text that will get adapted before output';
$find[0] = '/text/';
$find[1] = '/adapted/';
$replace = 'changed';
echo preg_replace($find, $replace, $users_string);
?>

Obviously you would change the contents of the $find array to words/phrases that you wish to replace ($replace is what replaces these) and obviously the $user_string variable would be changed to the variable that holds the post.
 
0
•••
If he said anything about forms, $_GET, or $_POST, I could help. He asked to do it via .htaccess and that's what I did.
 
0
•••
tandiono said:
so if any of "dick head" words were post it will be automatically change to "praise the mighty lord"

come on dan is it not obvious from the above qoute he as on about posts by other people on the site.
 
0
•••
I gave him what he asked for. All I was trying to do was help him.

tandiono said:
"dick head" to "praise the mighty lord" by .htaccess ?
 
0
•••
Stop arguing, lol.

Its easy to make a simple mistake about different web technologies.
 
0
•••
that's allright guys :)


Thanks for the help.. I'll try to play around with it..
 
0
•••
.htaccess can't do this, only a server side program such as PHP can do this.
The example filth@flexiwebhost gave would work as well as the str_replace function.
 
0
•••
Borghunter said:
.htaccess can't do this, only a server side program such as PHP can do this.
The example filth@flexiwebhost gave would work as well as the str_replace function.

I may be wrong, but I think .htaccess can only effect what is acually displayed in the browser, or to what page the browser visits. I don't believe it actually changes anything on an html web page level.

I would suggest a better solution would be to filter before the post is actually written, or find/replace the posted text shortly after written. To help with that, we would probably need to know the application being used and the format of the posting (HTML form, PHP, etc.)
 
0
•••
AdoptableDomains said:
I may be wrong, but I think .htaccess can only effect what is acually displayed in the browser, or to what page the browser visits. I don't believe it actually changes anything on an html web page level.
.htaccess can do loads more things than what is "shown" in these types of threads.

If tandiono is looking for help with an HTML <form .. that uses method="post", .htaccess won't be able to help. It could help, however, if it used get.
 
0
•••
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back