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

need help adjusting xenforo htaccess for own use

Jake Bunce

XenForo moderator
Staff member
#5
You are forcing me to learn this stuff. :confused:

Use this .htaccess code:

Code:
RedirectMatch 301 ^/news([^_]+)_([^.]+)\.html$ /index.php?threads/$2.$1/
 
#8
It is in the web root, i am using the htaccess file that comes with Xenforo, just appending this to it as my xenforo install is in my root.
 

James

Well-known member
#9
You are forcing me to learn this stuff. :confused:

Use this .htaccess code:

Code:
RedirectMatch 301 ^/news([^_]+)_([^.]+)\.html$ /index.php?threads/$2.$1/
You could just write it as such:
Code:
RedirectMatch 301 ^/news([^_]+)_([^.]+)\.html$ /index.php?threads/$1/
That should just use /threads/threadID
 
#12
Yeah...and i understand this.

My point is instead of redirecting it gives a 404 not found (exactly what i said :p), the code is in the htaccess file but it doesn't seem to run.
 

Jake Bunce

XenForo moderator
Staff member
#15
Your forum isn't using friendly URLs so you don't need those rewrite rules. But in my testing this redirect still works if you place it at the end of XenForo's htaccess file.
 
#16
This is my htaccess from xenforo

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

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

RedirectMatch 301 ^/news([^_]+)_([^.]+)\.html$ /index.php?threads/$2.$1/
That is currently at the website root, and as you can see it doesn't work :/
 

Brogan

XenForo moderator
Staff member
#20
You may need to tweak the rule slightly.
Different servers seem to handle them differently.

For example I can't use the non-www rule which is used here on xenforo.com on my server, I had to use a different one.

Edit: Never mind, looks like it's sorted.