简体   繁体   中英

Htaccess Rewrite to remove directory

I need help creating a rewrite string to remove the ~12345678/ from the following: www.example.com/~12345678/file.

This doesn't appear on every link. What happened is during development links were created using the development url, there are a couple dozen links that appear this way. The rest of the links are fine. I already use a rewrite to remove index.php.

尝试以下操作(这会将对www.example.com/~12345678/dir/file.ext任何请求重定向到www.example.com/dir/file.ext ):

RewriteRule ^\~[a-zA-Z0-9]+/(.*)?$ /$1 [L,QSA,R=301]

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