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

number in topic title will damage url

Discussion in 'Troubleshooting and Problems' started by majafy, Aug 24, 2016.

  1. majafy

    majafy Member


    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]

  2. Pierce

    Pierce Active Member

  3. majafy

    majafy Member

  4. Mike

    Mike XenForo Developer Staff Member

    This is caused by custom rewrites that you have. You need to adjust them to not match a valid XenForo URL.
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

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

    Did you import from vB by chance?
  6. majafy

    majafy Member

    I did convert my vBulletin database to XenForo without any problem, and then use this script to redirect vBulletin topics url to XenForo:

    this is my .htaccess file content:
    #    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
    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]
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member


    Replace this line:

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

    # 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.
    majafy likes this.
  8. majafy

    majafy Member

    Thanks Jake,
    My problem solved.

Share This Page