1 year ago

#368769

test-img

Yagami

How do you 301 redirect index.htm to root?

I just realized that mydomain.com and mydomain.com/index.htm may be considered duplicate content. So I just thought of doing a permanent 301 redirect from index.htm to root but I don't exactly know how to do it since I have existing .htaccess codes that may cause conflict.

I have below code in my .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC,OR]
RewriteCond %{SERVER_PORT} =80
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

From searching over the internet I found that some people use the code below:

RewriteRule ^index\.htm$ / [R=301,L]

Is the above single line of code correct, and is the proper way to do it? If so, how do I insert or append it from my existing .htaccess codes above?

redirect

rules

0 Answers

Your Answer

Accepted video resources