简体   繁体   中英

Remove folder name from URL using .htaccess, but not admin

Wanted to remove directory name /front/ from the URL using .htaccess but not /admin/ . Below code is working fine and also redirects /admin/ to /pages/admin/

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !(.*)front|shared
RewriteRule ^(.*)$ front/$1 [L]

Please suggest to avoid /admin/ redirection.

Thanks

You can try with this code:

RewriteEngine On
RewriteBase /

RewriteRule ^front/(.*)$ /$1 [L,NC,R]

Have it this way:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(front|shared) [NC]
RewriteRule ^(.*)$ front/$1 [L]

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