[TH] Shorter Routes [Deleted]

m1ne

Well-known member
Id like to delete this addon after 2 years. How can redirect from general urls?
Yeah, I need to know that as as well, due to upgrading to XF2.

Cheers

Chris
How can we use this addon for xenforo 2? Or return the old urls with htaccess? Please help us..
have you found a way to solve this?

Code:
RewriteEngine On

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

Mick West

Well-known member
Same for Nginx

Code:
    rewrite ^/[^\./]+\.f([0-9]+)/$ /forums/$1/ permanent;
    rewrite ^/[^\./]+\.t([0-9]+)/(.*)$ /threads/$1/$2 permanent;

Note the extra (.*) and $2 in the thread rewrite - to fix links to individual posts. You could add that to the htaccess version
 

dotpro

Active member
Same for Nginx

Code:
    rewrite ^/[^\./]+\.f([0-9]+)/$ /forums/$1/ permanent;
    rewrite ^/[^\./]+\.t([0-9]+)/(.*)$ /threads/$1/$2 permanent;

Note the extra (.*) and $2 in the thread rewrite - to fix links to individual posts. You could add that to the htaccess version

HI,

Does this redirect to default URLs/routes?

my xenforo is installed in sub category /forums/ so to remove extra "forums" after /forums" i was using the add-on but with the upgrade it seems the default behavior is back. I have the above rewrite rule in nginx conf file but doesn't seem to be working, am i missing something?
 

Pseudonym

Member
When using vBulletin I used vBSEO to alter my URL structure and it seemed to reap benefits for me in terms of result ranking, at least on obscure search terms.

url.ext/forum-name
url.ext/thread-id/thread-name

I thought I had researched my choice of XF pretty well but I didn't research Route Filters well enough to realise this wasn't possible out of the box and actually is seemingly quite difficult to achieve. I'm no coder and I've spent many hours researching a way to return to this URL structure and this add-on is the closest I can get. It's disappointing to find that it's no longer supported or working on the latest versions.

Had it been working, removing the node ID from the URL would have been useful provided no 2 forums produced the same URL and I don't think having the thread ID at the end of the URL rather than the beginning would make much difference and in fact would likely be preferential.

Hopefully I can figure out how to get this working on the latest version, somehow!
 

Slyk

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

    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]
    RewriteRule ^/[^\./]+\.f([0-9]+)/$ /forums/$1/ [R=301,L]
    RewriteRule ^/[^\./]+\.t([0-9]+)/(.*)$ /threads/$1/$2 [R=301,L]
</IfModule>

but i'm not getting the desired results.
 

Slyk

Member
Same for Nginx

Code:
    rewrite ^/[^\./]+\.f([0-9]+)/$ /forums/$1/ permanent;
    rewrite ^/[^\./]+\.t([0-9]+)/(.*)$ /threads/$1/$2 permanent;

Note the extra (.*) and $2 in the thread rewrite - to fix links to individual posts. You could add that to the htaccess version
I could really use some help.

Adding the above to '/etc/nginx/nginx.conf' (in a "location / { }" statement) and the htaccess equivalent that @m1ne identified to '/var/www/html/<url>/forum/.htaccess' doesn't have the desired effect (.htaccess has no impact; nginx results in error).

Am I missing something? Any help would be greatly appreciated!
 
Last edited:
Top