如何重定向
例如,如果我在搜索栏中输入subdomain.example.com,我点击enter,它会将我重定向到subdomain.example.com/page
如何在.htaccess中做到这一点
这是我在.htaccess中的功能,但它不起作用:
#If Url is entered
RewriteCond %{HTTP_HOST} ^subdomain.example.com [NC]
#Redirect to
RewriteRule ^(.*)$ http://subdomain.example.com/page/$1 [L,R=301]发布于 2014-11-02 14:14:21
您可以在子域的根.htaccess中使用此规则:
RewriteEngine On
#If Url is entered
RewriteCond %{HTTP_HOST} =subdomain.example.com
#Redirect to
RewriteRule ^((?!page/).*)$ /page/$1 [L,R=301,NC]https://stackoverflow.com/questions/26695551
复制相似问题