• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 302 Redirect

#1
Hello,

I discovered my redirects are coming back as 302 and not 301. I think I narrowed it down to the .htaccess which I did not write.

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.wrestlingsmarks.com [NC]
RewriteRule ^(.*)$ http://wrestlingsmarks.com/$1 [L,R=301,NC]

#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default



<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]

# vbseo rewrite rules
RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
</IfModule>
Do you see anything that should be changed or not there at all?
 

Mike

XenForo developer
Staff member
#7
Actually, given that you appear to be redirecting to redirection scripts, that may not be what you want. Can you give some examples of the old URLs?
 
#8
Actually, given that you appear to be redirecting to redirection scripts, that may not be what you want. Can you give some examples of the old URLs?
I didn't write the code, but I believe it was when they switched from vBulletin to XF and didn't want to lose their VB links.

Whatever it is is causing my domain forwards to give off 302 redirects. I have another domain thewweforum.com that directs to my main domain.
 
#10
# vbseo rewrite rules
RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
I've determined that this part was definitely the problem and it appears the person who wrote it got it here: https://www.rivmedia.co.uk/vbseo-xenforo-rewrite-rules-redirect-vbseo-urls-xenforo/1828

It appears they were trying to preserve vBSeo? Can someone tell me if I still need this at all or what I should do to fix it. Please and thank you.
 

Mike

XenForo developer
Staff member
#11
Well you can change what I recommended for those parts and that will probably be that, but I was still looking for a example URL so I could look at specific details of the request.
 
#12
Well you can change what I recommended for those parts and that will probably be that, but I was still looking for a example URL so I could look at specific details of the request.
Since I didn't add the code I don't know what specific links they were trying to redirect. I posted above I believe it had to do VBSEO. So I assume they had VBSEO on the forum when it was Vbulletin and they had unique links they didn't want to lose. The link I noticed the 302 on was when I was checking on a forward for my domain thewweforum.com which should only 301 to my main domain.
 

Mike

XenForo developer
Staff member
#13
If it's only when redirecting the external domain, then it's not going to be those rules. It's unlikely to be this .htaccess as that probably isn't even applying until you end up at the new domain. It'll be something on the old domain (which is indeed doing some weird redirects, even beyond the 302).
 
#14
If it's only when redirecting the external domain, then it's not going to be those rules. It's unlikely to be this .htaccess as that probably isn't even applying until you end up at the new domain. It'll be something on the old domain (which is indeed doing some weird redirects, even beyond the 302).
OK, thanks. I'll have to look into what is causing that. I appreciate the responses.
 
#17
I dug down the rabbit hole and found out GoDaddy has been telling people they've been doing 301 redirects for years and have really only been doing 302 directs. So if anyone that reads this currently forwards a domain through GoDaddy remove that redirect immediately and do it through .htaccess.