Home I want to disable the access of a directory but not the child directory with .htaccess
Reply: 0

I want to disable the access of a directory but not the child directory with .htaccess

user949
1#
user949 Published in June 20, 2018, 11:04 pm

I want to disable the access of a directory but not the child directory with .htaccess

i already written a rewrite rules to redirect everything to a child directory (public_html), but its parent is still accessible if the user know the url, i want to disable the access of the current directory not the child directory

    # Turn on rewrites.
    RewriteEngine on

    # Only apply to URLs on this domain
    RewriteCond %{HTTP_HOST} ^(www.)?domain.com$

    # Only apply to URLs that aren't already under folder.
    RewriteCond %{REQUEST_URI} !^/folder/

    # Don't apply to URLs that go to existing files or folders.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # Rewrite all those to insert /folder.
    RewriteRule ^(.*)$ /folder/$1

    # Also redirect the root folder.
    RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
    RewriteRule ^(/)?$ folder/index.php [L]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.417814 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO