.htaccess: How to remove subfolder's subfolder in URL?

后端 未结 1 1892
一生所求
一生所求 2021-01-22 02:29

I\'m trying to redirect this URL www.domain.com/~username to www.domain.com/~username/public but remove the /public from the URL.

相关标签:
1条回答
  • 2021-01-22 03:11

    You can try this code:

    RewriteEngine on
    RewriteBase /~username/
    
    RewriteCond %{THE_REQUEST} ^GET\ /public/ [NC]
    RewriteRule ^public/(.*)$ $1 [L,R=301,NE]
    
    RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
    
    0 讨论(0)
提交回复
热议问题