Redirecting Subdirectory to Subdomain with htaccess

后端 未结 5 1566
再見小時候
再見小時候 2021-01-06 09:38

I\'m relatively new to using .htaccess, and have never done any coding besides what I\'ve read online. I\'m using Bluehost, and I\'d like to redirect my blog subdirectory t

5条回答
  •  轮回少年
    2021-01-06 09:50

    To redirect subdomain1 and subdomain2 and directory3 to a directory with HTTPS://, I use the following code:

    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^subdomain1.example.com [OR]
    RewriteCond %{HTTP_HOST} ^subdomain2.example.com [OR]
    RewriteCond %{HTTP_HOST} ^example\.com/subdomain3 [NC]
    RewriteRule ^(.*)$ https://example.com/subdirectory/$1 [R=301,L]
    

提交回复
热议问题