如何用.htaccess替换某些URL

时间:2014-02-25 13:25:44

标签: .htaccess

我的网站上有这样的网址:

www.website.com/user/page/someName1
www.website.com/user/page/someName2
www.website.com/user/page/someName3

如何删除或隐藏/用户/页面.htaccess以此结束:

www.website.com/someName1
www.website.com/someName2
www.website.com/someName3

1 个答案:

答案 0 :(得分:0)

您可以使用:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+user/page/(\S+) [NC]
RewriteRule ^ /%1 [R=301,L]

RewriteRule ^user/page/(.+)$ /$1 [L,NC]