简体   繁体   中英

.htaccess edit to hide folder in the server

I am trying to hide my folders inside my server to be shown in the URL, I have a website hosted by bluehost. I tried several .htaccess change, but no luck. Anyone care to let me know what i did wrong? I am trying to have www.domain.com/application/models/login.php as www.domain.com/login.php instead. I tried this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^\/application\/models\/(.*)$ \/login\.php$ [NC,L]

and this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^application\/models\/login\.php$ "http\:\/\/domain\.com\/" [R=301,L]

But none of which works :(

Put this in .htaccess at your document root :

RewriteEngine on
RewriteRule ^/?login.php$   application/models/login.php  [L]

Put this .htaccess in your "models" folder:

  RewriteEngine on
  RewriteRule (.*)$ /$1 [R=301,L]

it will redirect www.domain.com/application/models/login.php to www.domain.com/login.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM