The MU forums have moved to WordPress.org

Changing a 302 redirect to a 301? (3 posts)

  1. slipxaway
    Member
    Posted 17 years ago #

    Hi, I was wondering if someone could help me figure out how to change a 302 redirect to a 301. Currently http://www.emoscene.com does a 302 redirect to emoscene.com, I looked at the .htaccess file, but I can't figure it out and I don't want to mess up anything that WPMU needs. I tried changing it to [R=permanent,L] but that gave me a 500 error.

    RewriteEngine On
    RewriteBase /

    # Rewrite http://www.domain.com to domain.com
    RewriteCond %{HTTP_HOST} ^www\.(.*)
    RewriteRule ^(.*)

    http://%1/$1 [R,L]

    #uploaded files
    RewriteRule ^(.*)?/?files/(.*)

    wp-content/blogs.php?file=$2 [L]

    RewriteCond %{REQUEST_FILENAME} -f

    [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule

    ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

  2. andrea_r
    Moderator
    Posted 17 years ago #

    Well, it redirected invisibly for me, but this is the line that does it:

    RewriteCond %{HTTP_HOST} ^www\.(.*)

    It's recommended you leave it there though.

  3. slipxaway
    Member
    Posted 17 years ago #

    Ok, I figured it out.. Its in the line

    RewriteRule ^(.*) http://%1/$1 [R,L]

    All I had to do was change [R=301,L] The example I saw said to do [R=permanent,L], which didnt work for me.

    It was redirecting invisibly, but it was a 302 redirect, which isn't search engine friendly.
    Thanks for the input though, I always appreciate your help :)

About this Topic

  • Started 17 years ago by slipxaway
  • Latest reply from slipxaway