我想把我的子域名注册页面重定向到我的域名注册页面在.htaccess中的wordpress多站点。我正在使用下面的代码,但它不起作用。
//301 Redirect Entire Directory
RedirectMatch 301 http://sub.domain.com/register/(.*) http://domain.com/register//$1我错过了什么?
发布于 2016-01-15 01:20:58
您不能以这种方式使用mod_alias(redirectmatch)。如果要根据主机名进行匹配,则必须使用mod_rewrite。
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sub\.domain\.com$
RewriteRule ^register/(.*)$ http://domain.com/register/$1 [R=301,L]如果.htaccess位于sub.domain.com的根中,则只需使用绝对路径即可。
RedirectMatch 301 ^/register/(.*)$ http://domain.com/register/$1https://stackoverflow.com/questions/34802299
复制相似问题