1

I have this in my .htaccess file:

RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L] 

It should work fine but give me error

http://www.website.com/public_html/ Not Found

The requested URL /public_html/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request.

2 Answers2

0

Force www:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
Community
  • 1
  • 1
Parth Chavda
  • 1,819
  • 1
  • 23
  • 30
  • Hey Parth, DId it but still getting error when go for website.com it redirect me to www.website.com/public_html with error "Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request." – Vikas Temgire Jul 08 '17 at 04:29
  • for taht you have to create rewrite rule.please check this link http://www.inmotionhosting.com/support/website/how-to/set-404-via-htaccess – Parth Chavda Jul 08 '17 at 04:37
  • ErrorDocument 404 /error/404page.html – Parth Chavda Jul 08 '17 at 04:40
0

The root ispublic_html so www.website.com goes to that folder as the document root.

Difster
  • 3,264
  • 2
  • 22
  • 32
  • That is true Difster but its gives me an error "Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request." when I have all webpage loaded and work perfectly when I go for www.website.com but gives error when go for website.com – Vikas Temgire Jul 08 '17 at 04:26
  • In your Apache config file, is your document root configured correctly? – Difster Jul 08 '17 at 04:27
  • Yes, It works fine for all other webs on my server....Having issues only with this web – Vikas Temgire Jul 08 '17 at 04:30