Configuring Web access to the Textpattern admin folder


Tested on Txp 4.5, Txp 4.6, Txp 4.7-dev

What is he doing:

  • Allow web access to /textpattern/index.php and /textpattern/setup/index.php
  • Allow web access to js, css, images
  • Deny web access to other files

.htaccess, place it to admin folder

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Uncomment if you need web access to some folder
#    RewriteCond %{REQUEST_FILENAME} /textpattern/some_folder [OR]

    # Allow web access to /textpattern/index.php and /textpattern/setup/index.php
    RewriteCond %{REQUEST_FILENAME} /textpattern/(setup/)?(index\.php)?$ [OR]

    # Allow web access to js, css, images
    RewriteCond %{REQUEST_FILENAME} \.(js|css|svg|png|jpg|gif|ico)$ [NC]
    RewriteRule ^(.*) - [L]

    # Deny web access to other files
    RewriteRule ^(.*) - [F,L]
</IfModule>

Textpattern Tips and Tricks: