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

XF 1.5 understanding how route filters work

island

Active member
#1
After doing a vbulletin import where vbulletin was in a forums subdirectory and xenforo will be in the root directory, I had the following remaining on the server after the import:

/index.php (new xenforo index)
/forums/customavatars/
/forums/customsignaturepics/
/gallery/data/

I noticed that the xenforo default /forums/forum-name-1 link works fine even with the /forums/customavatars directory existing.

However, editing the XFMG default route filter from media to gallery made it not work until I removed the /gallery directory.

How do these two functions (the default /forums/forum-name-1 link and the /gallery link router filter to XFMG) differ in how they function?
 

Mike

XenForo developer
Staff member
#2
Route filters wouldn't be involved there. The difference would be down to what is in those directories and the URLs being requested. Notably, because you have a gallery directory, gallery/ is a valid directory and thus not something that we can rewrite into XF. forums/forum-name.1/ is not valid so it ends up in XF; forums/ wouldn't.

Generally speaking, you should remove those sub-directories unless it's very important that they exist. If the files are being referenced directly, you may wish to consider moving them and making specific rewrite rules to cover those files.
 

island

Active member
#3
Thanks Mike. I believe I understand now.

In this case, since there is no /gallery/data/ URL used in xenforo XFMG, it appears it works to move the old directory from gallery/data to archivegallery/data, and then add
Code:
RewriteRule ^gallery/data/(.*)$ /archivegallery/data/$1 [R=301,NC,L]
to the beginning of the modrewrite directives, and it appears this does not conflict with xenforo serving XFMG at /gallery since there is no /gallery/data function.

I would like to install xenforo in the root directory because previously /gallery/ was established and separate from the forum.
I would like to keep /gallery/ as the gallery URL and not have to have /forums/gallery/ for XFMG.

One concern I had upon realizing the potential for a subdirectory existing disabling a xenforo function is if any future xenforo node type or function conflicts with a subdirectory of my 20-year old site..

It appears though that I can use a route filter to adjust the xenforo URL structure in such a case as a conflict develops with an existing physical subdirectory that can't be easily moved. For example, if I hypothetically had an /online/ directory it would conflict with the current visitors online link in xenforo, but creating a route filter to change /online to /whosonline in xenforo would get around this and allow me to keep the online subdirectory serving other application or files.