GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   .htaccess (https://gfy.com/showthread.php?t=66482)

kenny 07-01-2002 04:32 PM

.htaccess
 
Is there a way to change all the links in my domain going to a certain domain to redirect to another.

EXAMPLE:

all links going to http://yahoo.com redirected to http://google.com

foe 07-01-2002 04:46 PM

Not with .htaccess I believe. You can change the mysql code by doing a replace on the file, fastest way

swedguy 07-01-2002 05:04 PM

Log on to your server with telnet or ssh.

find /home/bubba/domain.com -name '*.html' -exec perl -pi -e 's/http:\/\/www.yahoo.com/http:\/\/www.google.com/g' {} \;

Change /home/bubba/domain.com to the domain dir you want to mess around in.

If it's a linkingcode you're about to change, you need to escape (put an \ in front of it) certain characters: ? & /

Create a test dir with couple of test files in it to test on first.


btw, I do NOT give ANY guarantees :)

kenny 07-01-2002 05:21 PM

Quote:

Originally posted by swedguy
Log on to your server with telnet or ssh.

find /home/bubba/domain.com -name '*.html' -exec perl -pi -e 's/http:\/\/www.yahoo.com/http:\/\/www.google.com/g' {} \;

Change /home/bubba/domain.com to the domain dir you want to mess around in.

If it's a linkingcode you're about to change, you need to escape (put an \ in front of it) certain characters: ? & /

Create a test dir with couple of test files in it to test on first.


btw, I do NOT give ANY guarantees :)


I didn't really understand half of it, but I it worked:thumbsup

whats "-e" "-pi" "{}" for?

swedguy 07-02-2002 12:01 AM

{} = the file "find" found
-e = that you wanna do a one-liner
-i = that you wanna run the one-liner on a file ({} in this case)
-p = can't explain this one in an understandable way :) Taken from the man page....
causes Perl to assume the following loop around your script, which makes it iterate over filename arguments somewhat like sed.

Great that you got it to work :)


All times are GMT -7. The time now is 06:26 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123