sub-directory from exclusion of redirect/rewrite (.htaccess tweak)
-
Hi there,
WP has done a good afford on security, but I just get confused by the default .htaccess rules.
I have a WP installed in the root directory (e.g. https://mysite.com/), I want to exclude a sub-directory (e.g. /mydir) and the file inside (e.g. /mydir/myfile.php) from re-write rule for direct access.
I have changed file permission of myfile.php to 775.
I hope that I can directly execute myfile.php by below url.
https://mysite.com/mydir/myfile.phpHowever, I got redirect to 404.
I know it is a .htaccess issues, so I added below code in my .htaccess in root folder:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_URI} !^/mydir/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
May anyone has done it before? Any comments welcome. Thank you.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘sub-directory from exclusion of redirect/rewrite (.htaccess tweak)’ is closed to new replies.