How to fix localhost redirecting to

I have got several request that when I browse the site on http://localhost/PROJECTNAME. Then it automatically redirect it to . These kind of issue can be available with almost all CMS based project like Drupal,  Prestashop, Joomla,  WordPress,  CS cart,  Magento etc..

If you are also facing this issue on your localhost then you just need to follow the instruction.

*. Open your .htaccess file (Usually found on root of the project) and comment below lines by placing # at the beginning of the file.

RewriteCond %{HTTP_HOST} !^www. [NC]

RewriteRule ^ <a href="http://www." target="_blank">http://www.</a>%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

That means simply replace these code with below code

#RewriteCond %{HTTP_HOST} !^www. [NC]
#RewriteRule ^ <a href="http://www." target="_blank">http://www.</a>%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Now save your .htaccess file and retry with browsing your project.

The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...