number in topic title will damage url

majafy

Member
Hello,

When my users create a topic and start the title of topics with number character the URL does not work,
for example title of topic is "10 tips and tricks for php", and when I want watch this topic I will route to http://[my forum]/threads/10.[blah blah blah]


Regards
 
If you post your .htaccess file then I can probably fix the offending rule for you.

Did you import from vB by chance?
I did convert my vBulletin database to XenForo without any problem, and then use this script to redirect vBulletin topics url to XenForo:
https://xenforo.com/community/resources/vbulletin-4-x-url-redirection.120/

this is my .htaccess file content:
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 enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule ^threads/([0-9]+)-.*$ /threads/$1? [R=301,L]

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

Replace this line:

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

...with this:

Code:
# exclude XF thread URLS
RewriteRule ^threads/[^\./]+\.[0-9]+ - [S=1]
# then redirect vB thread URLs
RewriteRule ^threads/([0-9]+)-.*$ /threads/$1? [R=301,L]

That should do it.
 
Back
Top Bottom