lundi 28 décembre 2020

.htaccess www to non-www not working for my site

I have a site hosted for free on 000webhost.com I have a problem with .htacces file. When I go to dd-myportfolio.000webhostapp.com , it redirects me to www.dd-myportfolio.000webhostapp.com and throws me error No such website...

Here is my .htaccess code:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ %{REQUEST_SCHEME}://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

ErrorDocument 404 /error-404

RewriteRule ^articles/$     /articles [L,R=301]
RewriteRule ^articles.html$     /articles [L,R=301]
RewriteRule ^articles/article/(.*)$     /site/index.php?param=article&id=$1 [L]
RewriteRule ^articles$               /articles [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) /site/index.php?param=$1 [L]

I just try so many www to non-www methods to resolve it but nothing helps with my case. Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire