除了登陆页面之外,我需要将子目录/plays/下的所有/plays/文章重定向到主目录(/)。
example.com/plays/hello,你会被重定向到example.com/helloexample.com/plays或example.com/plays/,你就会呆在那个页面上。我该怎么做?我假设必须通过.htaccess进行重定向,但我不知道如何实现。
发布于 2016-04-25 17:23:21
下列规则应有效:
RewriteEngine on
#if the request is for "/plays" or "/plays/", skip the rule#
RewriteCond %{REQUEST_URI} !^/plays/?$
#otherwise redirect to homepage#
RewriteRule ^plays/(.+)$ http://domain.com/$1 [R,L]https://stackoverflow.com/questions/36846377
复制相似问题