.htaccess

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kenny
    Confirmed User
    • Mar 2002
    • 7245

    #1

    .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
    7
  • foe
    Confirmed User
    • May 2002
    • 5246

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

    Comment

    • swedguy
      Confirmed User
      • Jan 2002
      • 7981

      #3
      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

      Comment

      • kenny
        Confirmed User
        • Mar 2002
        • 7245

        #4
        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

        whats "-e" "-pi" "{}" for?
        Last edited by kenny; 07-01-2002, 04:30 PM.
        7

        Comment

        • swedguy
          Confirmed User
          • Jan 2002
          • 7981

          #5
          {} = 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

          Comment

          Working...