0

How do I redirect

For example if I entered subdomain.example.com in the search bar I hit enter and it redirected me to subdomain.example.com/page

How do I do that in .htaccess

This is what I have in .htaccess but it doesn't work:

#If Url is entered    
RewriteCond %{HTTP_HOST} ^subdomain.example.com [NC]

#Redirect to    
RewriteRule ^(.*)$ http://subdomain.example.com/page/$1 [L,R=301]
anubhava
  • 761,203
  • 64
  • 569
  • 643
EDWIN3150
  • 1
  • 1

1 Answers1

0

You can use this rule in root .htaccess of subdomain:

RewriteEngine On

#If Url is entered
RewriteCond %{HTTP_HOST} =subdomain.example.com
#Redirect to    
RewriteRule ^((?!page/).*)$ /page/$1 [L,R=301,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643