We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.

More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsWordPressWordPress Administration

How to add a file to root directory of multisite

Lets say we have lots of websites by using WordPress multisite feature and we want to add a file to root directory of each file. This can be done easily by using single directive in .htaccess file.

  • First of all, upload the file to the hosting account. It may be uploaded to WordPress installation directory. For example, if it’s uploaded to “public_html/wp-content/file” and the permalinks structure is set to domain.com/file/file.txt,  but we want it to be accessible over domain.com/file.txt.
  • Open .htaccess file for editing. Usually it can be found in the public_html of WordPress installation directory.
  • Insert the following line to set redirect action: RewriteRule ^file.txt /file/file.txt [L]
  • Save and close .htaccess file to apply the changes and check how redirect is working in live websites.
Rate this Tutorial:
No CommentsLeave a Comment

Other (182)

Popular Keywords