XF 1.3 Privide me code htaccess to redirect old urls vb4 in search engine to new xf

Jake Bunce

XenForo moderator
Staff member
#3
Add these rules to the top of the .htaccess file in your /forum directory:

Code:
RewriteEngine On

RewriteRule ^threads/([0-9]+)-.*$ /threads/$1/ [R=301,L]
RewriteRule ^forums/([0-9]+)-.*$ /forums/$1/ [R=301,L]
 

jamalfree

Active member
#4

jamalfree

Active member
#6
# 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]
</IfModule>
this code origine to xenforo, where i should put code bellow, i hope give to me code with right change
tank you
 

Jake Bunce

XenForo moderator
Staff member
#7
Tank you for all
i try Jake Bunce the code look good but didnt work correctly
for example
http://localhost/xenforo/threads/33813-hello-world
redirect to
http://localhost/threads/33813/
i wait some help
That is different than your previous example. The old directory name is /xenforo instead of /forum.

In that case you need to add these rules to the top of the .htaccess file in your /xenforo directory:

Code:
RewriteEngine On

RewriteRule ^threads/([0-9]+)-.*$ /threads/$1/ [R=301,L]
RewriteRule ^forums/([0-9]+)-.*$ /forums/$1/ [R=301,L]
 
Top