Redirect /textpattern to /admin for multi-site installs

Since version 4.2.0, TXP supports multi-site installations from one TXP installation (all sites share the same TXP files, but are installed into different databases, and have their own admin and public folders).

In these kind of installations, the TXP admin side is moved from www.example.com/textpattern to www.example.com/admin (and there is also the option to move it to admin.example.com).

This minor change can break some TXP plugins that are still referencing stuff in /textpattern folder.

Possible fix

One possible fix could be to edit the plugins and change every reference of /textpattern to /admin. But, in the end, this will become a maintenance nightmare, as whenever a new version of the plugin is installed you mayhave to do it all over again.

Another possible fix could be to wait until the plugin author makes this change for us. But that may take time, or the plugin might be abandoned so the change won’t ever take place in an official release.

Using mod_rewrite

And then, there is this fix, that worked flawlessly for me in a few TXP installs.
It’s a simple change that implies adding a line to the .htaccess file on the root of your TXP website. In the case of a multi-site installation, the .htaccess file is located in the /public folder.

So, there, in that .htaccess file, you should add the next line above the <IfModule mod_rewrite.c> line:

Redirect 301 /textpattern /admin

That should be enough to fix most (if not all) TXP plugins, even those that use JS and CSS assets.

Finally, a last note: this fix doesn’t cover the case of using admin.example.com for your TXP admin side. I have yet to try that kind of install and figure out which will be, in that case, the best fix for the issue.

If you are in that situation and can’t wait for me to fix it, I suggest you to do a search for “redirect folder to subdomain”. You will probably find the solution in no time. Then come back here and share it in the comments. Or better yet, write a new TXP Tip!

comments powered by Disqus