.htaccess redirect 301 a.us/~user1 b.fr/~user2

Discussion in 'Apache' started by mullen1@uiuc.edu, Oct 28, 2008.

  1. #1
    Greetings -

    I have a person who has moved on to greener pastures. They would like to have any traffic selecting their old url/~name to be redirected to their new url/~name2.

    What I want is for user1 at a.us to be redirected to user2 at b.fr. The .htaccess file in their directory doesn't work. And I've tried a few permutations that made it worse.

    Currently .htaccess file looks like:
    Redirect 301 / http://b.fr/~user2/

    And the user_exceptions file on our server looks like:
    <Directory "/home/user1/public_html">
    AllowOverride FileInfo AuthConfig Limit
    Options SymLinksIfOwnerMatch Indexes
    Order allow,deny
    Allow from all
    </Directory>

    When I changed the .htaccess file to include index.html on both sides then it rewrote to http://b.fr/~user2/~user1/.
    .htaccess = Redirect 301 /index.html http://b.fr/~user2/~user1

    I was wondering if I could use the server variable REMOTE_USER. But searching the internet isn't helping me.

    This is probably a 5-minute problem that has taken me most of the morning to get this far. Do you have any other suggestions that might help?

    Tony -
     
    mullen1@uiuc.edu, Oct 28, 2008 IP
  2. mullen1@uiuc.edu

    mullen1@uiuc.edu Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    And after a bunch more mucking around I discovered the answer locally. ;-)

    Someone had set up a redirect directive in our httpd.conf. So after making sure (in the exceptions file) that our user could indeed use a .htaccess file I made the following change:

    Redirect 301 /~user1 http://b.fr/~user2

    I needed to explicitly add the local user. And I didn't need any trailing slashes.

    Pretty simple when you know the proper incantation. ;-)
     
    mullen1@uiuc.edu, Oct 29, 2008 IP