Home .htaccess, hide sub directories
Reply: 0

.htaccess, hide sub directories

user1733
1#
user1733 Published in July 18, 2018, 4:50 am

I am new to learning how .htaccess works and I am struggling on getting it to work how I want it to.

Here is my current .htaccess file:

RewriteOptions inherit

#ErrorDocument 404 https://tsrvtc.com/_pages/404page.html
#ErrorDocument 500 https://tsrvtc.com/_pages/500page.html
#ErrorDocument 403 https://tsrvtc.com/_pages/403page.html

<IfModule mod_rewrite.c>
RewriteBase /
RewriteEngine on

RedirectMatch 301 ^/?$ https://www.tsrvtc.com/index

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+_pages/([^\s]+) [NC]
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (?!^_pages/)^(.*)$ /_pages/$1 [L,NC]
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+vtc_manager/([^\s]+) [NC]
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (?!^vtc_manager/)^(.*)$ /vtc_manager/$1 [L,NC]

RewriteCond %{HTTP_HOST} ^tsrvtc\.com$ [NC]
RewriteRule ^(.*)$ http://www.tsrvtc.com/$1 [R=301,L]

</IfModule>
AuthName "public"
AuthUserFile "/home/tsrvtcco/.htpasswds/public_html/passwd"

It currently works hiding the _pages directory in the url but when I try to hide the vtc_managerm directory then goto the page within that directory it redirects to my domain name and puts index.php at the end. The I am given this error: https://gyazo.com/0cc504188657beafd2042d6332e4bd9b

Here is the layout of the directories:

public_html 
  _pages
  vtc_manager

Any assistance will be greatly appreciated.

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO