RewriteRule Help from SEO VB 3.7 to Xen

When you put a R=xxx in a rewriterule, you are telling Apache it's an external redirect and stating the HTTP status code the redirect should send to the browser. An external redirect requires a full URL:

RewriteRule ^forums\/f\d+\/.*-(\d+)\/ https://domainname.com/forums/showthread.php?t=$1 [R=301,L]

If you remove the R=301, it becomes an internal rewrite, not a redirect and does not use the R=301:
RewriteRule ^forums\/f\d+\/.*-(\d+)\/ /forums/showthread.php?t=$1 [L]
 
Thanks for the reply and that does help. I probably should have added is that I am trying to get XenForo Redirects for vBulletin 1.1.9 working. The site functions well.

Unfortunately my old VB had been using SEO urls for many years so all the old links look like = http://www.jeep-cj.com/forums/f2/locking-rear-axle-26009/
XenForo Redirects for vBulletin requires standard VB urls ex: ( http://www.domain.com/forums/showthread.php?t=$1 )
It does function correctly if I paste the non SEO url ( http://www.jeep-cj.com/forums/showthread.php?t=26009 ) in and automatically redirects to ( https://jeep-cj.com/community/threads/locking-rear-axle.56727/ ) as it should so I know the import table is correct.
Its only when I paste the SEO URL ( http://www.jeep-cj.com/forums/f2/locking-rear-axle-26009/ ) that it does not redirect and becomes ( https://jeep-cj.com/community/f2/locking-rear-axle-26009/ ) and cannot find the page.
oops.webp

I tied both
RewriteRule ^forums\/f\d+\/.*-(\d+)\/ /forums/showthread.php?t=$1 [R=301,L]
and
RewriteRule ^forums\/f\d+\/.*-(\d+)\/ /forums/showthread.php?t=$1 [L]
so that leads me to believe its my actual expression but I'm not sure?

Does the expression look correct?

Thanks again!
 
What other redirects do you have in .htaccess or .htaccess that is in a parent directory?

Because based on what you're saying, it sounds like other rewriterule is processing the URL first, because there is no "community" anywhere in the rewrite you present.
 
Thanks again. I'm following these -->> INSTRUCTIONS

My (copied from src/addons/XF301VB/SourceLocation/) index.php in the old vb forums directory is
Code:
<?php

// Enter the full path to your XenForo directory here:
$dir = '/home/jeepcj/public_html/community';

require($dir . '/src/XF.php');

XF::start($dir);
XF::runApp('XF301VB\Pub\App');
And the .httaccess file in the old vb forums directory is
Code:
#    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 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    RewriteEngine On

# RewriteRule [^/]+/([0-9]+)-[^/]+\.html http://www.domain.com/forums/showthread.php?t=$1 [L,R=301]

RewriteRule ^forums\/f\d+\/.*-(\d+)\/ /forums/showthread.php?t=$1 [L]

    #    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]
</IfModule>

Here are the board settings
rww2.JPG

rww3.JPG

And the import table is

rww1.JPG

The Xen .httaccess in the community directory is:
Code:
#    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 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 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 workaround HTTP Basic auth issues when using 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]
</IfModule>

The addon works with a VB non SEO old url but not with the SEO url.
Thanks for your insight, I'm still trying to chase this.
Disabling "Enable board URL canonicalization" has no impact.
 
Last edited:
Have you tried modifying this to reflect the /community location you appear to have installed in?
Thanks but no go. FYI - I always work in an incognito window when testing to eliminate browser cache issues.

With board URL canonicalization = Enable and or Disable and RewriteBase /community
URL http://www.jeep-cj.com/forums/showthread.php?t=26009 gives "Forum not found" and will not acknowledge the cookie.
td1.webp
td1a.webp

URL http://www.jeep-cj.com/forums/f2/locking-rear-axle-26009/ gives "Page not found" and will not acknowledge the cookie.
td1b.webp
td1a.webp

Thanks again.
 
Is there anyway to have Apache log all hits and especially rewrites so I can try and trace this problem? I'm stumped...

This my log even with trace enabled. The 1st two lines do not work but the last two do.
Code:
72.238.24.*** - - [30/Dec/2022:20:12:16 -0500] "GET /forums/f2/locking-rear-axle-26009/ HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
72.238.24.*** - - [30/Dec/2022:20:12:18 -0500] "GET /forums/f2/locking-rear-axle-26009/ HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
72.238.24.*** - - [30/Dec/2022:20:12:37 -0500] "GET /forums/showthread.php?t=26009 HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
72.238.24.*** - - [30/Dec/2022:20:12:39 -0500] "GET /forums/showthread.php?t=26009 HTTP/1.1" 301 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
 
Last edited:
Well I figured out to trace modrewrites in the appache log in httpd.conf, change LogLevel to alert rewrite:trace6 (be aware of your server slow down so just do it temp.)
Here is the trace for the rewrite. I haven't found where it fail.
Code:
[Fri Dec 30 21:42:46.342645 2022] [rewrite:trace2] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] init rewrite engine with requested uri /forums/f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342667 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] applying pattern '^' to uri '/forums/f2/locking-rear-axle-26009/'
[Fri Dec 30 21:42:46.342676 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] RewriteCond: input='/forums/f2/locking-rear-axle-26009/' pattern='^/\\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$' => not-matched
[Fri Dec 30 21:42:46.342682 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] RewriteCond: input='/forums/f2/locking-rear-axle-26009/' pattern='^/\\.well-known/pki-validation/(?:\\ Ballot169)?' => not-matched
[Fri Dec 30 21:42:46.342687 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] RewriteCond: input='/forums/f2/locking-rear-axle-26009/' pattern='^/\\.well-known/pki-validation/[A-F0-9]{32}\\.txt(?:\\ Sectigo\\ DCV)?$' => not-matched
[Fri Dec 30 21:42:46.342703 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] RewriteCond: input='/forums/f2/locking-rear-axle-26009/' pattern='^/\\.well-known/acme-challenge/[0-9a-zA-Z_-]+$' => not-matched
[Fri Dec 30 21:42:46.342708 2022] [rewrite:trace1] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] pass through /forums/f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342900 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] add path info postfix: /home/jeepcj/public_html/forums/f2 -> /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342909 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] strip per-dir prefix: /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/ -> f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342913 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] applying pattern '^forums\\/f\\d+\\/.*-(\\d+)\\/' to uri 'f2/locking-rear-axle-26009/'
[Fri Dec 30 21:42:46.342918 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] add path info postfix: /home/jeepcj/public_html/forums/f2 -> /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342923 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] strip per-dir prefix: /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/ -> f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342932 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] applying pattern '^.*$' to uri 'f2/locking-rear-axle-26009/'
[Fri Dec 30 21:42:46.342940 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] RewriteCond: input='/home/jeepcj/public_html/forums/f2' pattern='-f' => not-matched
[Fri Dec 30 21:42:46.342946 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] RewriteCond: input='/home/jeepcj/public_html/forums/f2' pattern='-l' => not-matched
[Fri Dec 30 21:42:46.342951 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] RewriteCond: input='/home/jeepcj/public_html/forums/f2' pattern='-d' => not-matched
[Fri Dec 30 21:42:46.342955 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] add path info postfix: /home/jeepcj/public_html/forums/f2 -> /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342963 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] strip per-dir prefix: /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/ -> f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342976 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] applying pattern '^(data/|js/|styles/|install/|favicon\\.ico|crossdomain\\.xml|robots\\.txt)' to uri 'f2/locking-rear-axle-26009/'
[Fri Dec 30 21:42:46.342985 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] add path info postfix: /home/jeepcj/public_html/forums/f2 -> /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.342999 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] strip per-dir prefix: /home/jeepcj/public_html/forums/f2/locking-rear-axle-26009/ -> f2/locking-rear-axle-26009/
[Fri Dec 30 21:42:46.343008 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] applying pattern '^.*$' to uri 'f2/locking-rear-axle-26009/'
[Fri Dec 30 21:42:46.343015 2022] [rewrite:trace2] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] rewrite 'f2/locking-rear-axle-26009/' -> 'index.php'
[Fri Dec 30 21:42:46.343019 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] add per-dir prefix: index.php -> /home/jeepcj/public_html/forums/index.php
[Fri Dec 30 21:42:46.343025 2022] [rewrite:trace2] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] strip document_root prefix: /home/jeepcj/public_html/forums/index.php -> /forums/index.php
[Fri Dec 30 21:42:46.343029 2022] [rewrite:trace1] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8c914f0/initial] [perdir /home/jeepcj/public_html/forums/] internal redirect with /forums/index.php [INTERNAL REDIRECT]
[Fri Dec 30 21:42:46.343054 2022] [rewrite:trace2] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] init rewrite engine with requested uri /forums/index.php
[Fri Dec 30 21:42:46.343059 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] applying pattern '^' to uri '/forums/index.php'
[Fri Dec 30 21:42:46.343065 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] RewriteCond: input='/forums/index.php' pattern='^/\\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$' => not-matched
[Fri Dec 30 21:42:46.343070 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] RewriteCond: input='/forums/index.php' pattern='^/\\.well-known/pki-validation/(?:\\ Ballot169)?' => not-matched
[Fri Dec 30 21:42:46.343074 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] RewriteCond: input='/forums/index.php' pattern='^/\\.well-known/pki-validation/[A-F0-9]{32}\\.txt(?:\\ Sectigo\\ DCV)?$' => not-matched
[Fri Dec 30 21:42:46.343084 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] RewriteCond: input='/forums/index.php' pattern='^/\\.well-known/acme-challenge/[0-9a-zA-Z_-]+$' => not-matched
[Fri Dec 30 21:42:46.343088 2022] [rewrite:trace1] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] pass through /forums/index.php
[Fri Dec 30 21:42:46.343108 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] [perdir /home/jeepcj/public_html/forums/] strip per-dir prefix: /home/jeepcj/public_html/forums/index.php -> index.php
[Fri Dec 30 21:42:46.343113 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] [perdir /home/jeepcj/public_html/forums/] applying pattern '^forums\\/f\\d+\\/.*-(\\d+)\\/' to uri 'index.php'
[Fri Dec 30 21:42:46.343117 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] [perdir /home/jeepcj/public_html/forums/] strip per-dir prefix: /home/jeepcj/public_html/forums/index.php -> index.php
[Fri Dec 30 21:42:46.343121 2022] [rewrite:trace3] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] [perdir /home/jeepcj/public_html/forums/] applying pattern '^.*$' to uri 'index.php'
[Fri Dec 30 21:42:46.343128 2022] [rewrite:trace4] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] [perdir /home/jeepcj/public_html/forums/] RewriteCond: input='/home/jeepcj/public_html/forums/index.php' pattern='-f' => matched
[Fri Dec 30 21:42:46.343132 2022] [rewrite:trace1] [pid 9681] mod_rewrite.c(486): [client 72.238.24.214:28004] 72.238.24.214 - - [www.jeep-cj.com/sid#560fb8b2ac18][rid#560fb8ca62d8/initial/redir#1] [perdir /home/jeepcj/public_html/forums/] pass through /home/jeepcj/public_html/forums/index.php

Any idea?
 
Well, still cannot get this to function. I added this rewrite to the old VB forums httaccess RewriteRule http://www.jeep-cj.com/forums/f2/locking-rear-axle-26009/ http://www.jeep-cj.com/forums/showthread.php?t=26009 [L,R=301] and still get page not found. Should that pick up the specific input URL and change it?
If I input http://www.jeep-cj.com/forums/f2/locking-rear-axle-26009/ = Page not found
If I input http://www.jeep-cj.com/forums/showthread.php?t=26009 it successfully redirects to url [URL]https://jeep-cj.com/community/threads/locking-rear-axle.56727/[/URL]
If I use single redirect it DOES work RedirectMatch 301 /forums/f2/locking-rear-axle-26009/ /forums/showthread.php?t=26009

Has anyone seen this before or can offer another direction?
 
Last edited:
Try this .htaccess in the /forums folder

Code:
Code:
#    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 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /forums/

    RewriteRule ^f\d+/.*-(\d+) showthread.php?t=$1 [L]

    #    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]
</IfModule>
 
Got it!

Rewrite should be RewriteRule /forums\/f\d+\/.*-(\d+)\/ /forums/showthread.php?t=$1 [R=301,L] NOT RewriteRule ^forums\/f\d+\/.*-(\d+)\/ /forums/showthread.php?t=$1 [R=301,L]
I had to drop the ^ I hope this helps someone if they ever have the same problem.
 
Try this .htaccess in the /forums folder

Code:
Code:
#    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 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /forums/

    RewriteRule ^f\d+/.*-(\d+) showthread.php?t=$1 [L]

    #    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]
</IfModule>
Thanks, this helped me with my rule. :)
See -->> https://xenforo.com/community/threads/rewriterule-help-from-seo-vb-3-7-to-xen.211294/post-1607500
 
You shouldn't need the R=301 part - that will cause an extra un-necessary redirect.

XF should internally rewrite this for you.
 
You shouldn't need the R=301 part - that will cause an extra un-necessary redirect.

XF should internally rewrite this for you.
Thanks, your rewrite works also BUT - BOTH only work when clicking a link within the forum. Opening a new window results in Page not found and results in [URL]https://jeep-cj.com/community/f2/locking-rear-axle-26009/[/URL]
 
Still working on this. Can I get some guidance on this URL rewrite?

Original URL = http://www.jeep-cj.com/forums/f2/locking-rear-axle-26009/#post10258
Rewrite = RewriteRule ^forums\/f\d+\/.*-(\d+)\/ /forums/showpost.php?t=$2
Output URL = http://www.jeep-cj.com/forums/showpost.php?t=#post10258
Need URL = http://www.jeep-cj.com/forums/showpost.php?t=10258

I need to remove '#post' from the output URL.

Thanks for any Ideas.
 
Back
Top Bottom