0

I want to redirect non www to www urls,its working fine except

http://wellnessvisit.com/blog/

i want to redirect this to

http://www.wellnessvisit.com/blog/

while its working fine on all other urls but not working for this

below is my .htaccess file

RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule doctor-(.*)\.htm$ doctor-details.php?doc_id=$1
RewriteRule hospital-(.*)\.htm$ hospital_detail.php?hosp_spec_id=$1
RewriteRule hotel-(.*)\.htm$ hotel_details.php?hotel_id=$1
RewriteRule destination-(.*)\.htm$ destination_details.php?dest_id=$1
RewriteRule news-(.*)\.htm$ news-details.php?news_id=$1
RewriteRule article-(.*)\.htm$ articles-details.php?article=$1
RewriteRule service-(.*)\.htm$ service-details.php?service_id=$1
RewriteRule user-register.php$ register.php 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
#adds ".php" to a URL that isn't a directory or a file
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*)$ $1.php
user4035
  • 22,508
  • 11
  • 59
  • 94
Muhammad Rashid
  • 563
  • 1
  • 6
  • 25
  • I think, you did the redirect correctly. There is an old answer about it: http://stackoverflow.com/questions/12050590/redirect-non-www-to-www-in-htaccess. Maybe, something else is wrong? – user4035 Jun 27 '15 at 11:44
  • That single www rule looks fine to me. Did not check the rest though, since the question is specific. – arkascha Jun 27 '15 at 11:49
  • @user4035 where is wrong?i did not add any condition in my code,this is complete mt .htaccess file – Muhammad Rashid Jun 27 '15 at 11:56
  • @user4035 there is two .htaccess file one at the root and 2nd in blog – Muhammad Rashid Jun 27 '15 at 12:15
  • @user4035 i modify and save the blog .htaccess file now when i click on blog its redirecting to index page.i don't know why its happening – Muhammad Rashid Jun 27 '15 at 12:16
  • possible duplicate of [htaccess redirect for non-www both http and https](http://stackoverflow.com/questions/2015159/htaccess-redirect-for-non-www-both-http-and-https) – Sumurai8 Jun 27 '15 at 13:34

1 Answers1

0

When I click http://wellnessvisit.com/blog/, it redirects me to http://www.wellnessvisit.com/blog/. So the htaccess rules seems to be working fine.

The issue you face maybe due to cached redirects, try the above link in another browser or try clearing your browser's cache.

HSR
  • 141
  • 1
  • 9