Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

need help with htaccess file please

Posted on 2012-09-03
5
Medium Priority
?
922 Views
Last Modified: 2012-09-03
hi i am new to htaccess files. i would like to redirect the following urls
anniefontainelifecoach.co.uk
www.anniefontainelifecoach.co.uk
anniefontainelifecoach.co.uk/index.html
anniefontainelifecoach.co.uk/index.html/
http://www.anniefontainelifecoach.co.uk/index.html/

to:
http://www.anniefontainelifecoach.co.uk/

basicaly i would like all verions of the url to redirect over to http://www.anniefontainelifecoach.co.uk/

i have tried this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^anniefontainelifecoach.co.uk$
RewriteCond %{HTTP_HOST} ^www.anniefontainelifecoach.co.uk$
RewriteCond %{HTTP_HOST} ^anniefontainelifecoach.co.uk/index.html$
RewriteCond %{HTTP_HOST} ^anniefontainelifecoach.co.uk/index.html/$
RewriteCond %{HTTP_HOST} ^http://www.anniefontainelifecoach.co.uk/index.html/$
RewriteRule ^(.*)$ http://www.anniefontainelifecoach.co.uk/$1 [L,R=301]


but its not working. :(

can any one advise please?
0
Comment
Question by:helpchrisplz
  • 2
  • 2
5 Comments
 
LVL 30

Expert Comment

by:Randy Downs
ID: 38361519
Try this

http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/

RewriteCond %{HTTP_HOST} !^anniefontainelifecoach.co.uk\.com$ [NC]
RewriteRule ^(.*)$ http://anniefontainelifecoach.co.uk/$1 [R=301,L]
0
 
LVL 58

Expert Comment

by:Gary
ID: 38361536
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 38361628
Number-1

i try your example but it didn't work


GaryC123

that works but http://anniefontainelifecoach.co.uk/ 
and
http://anniefontainelifecoach.co.uk/index.html


are still available.
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 38361762
Not great at rewrite rules but try instead

RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^.*\/index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
RewriteCond %{http_host} ^anniefontainelifecoach.co.uk$ [nc]
RewriteRule ^(.*)$ http://www.anniefontainelifecoach.co.uk/$1 [r=301,nc,L]
0
 
LVL 1

Author Closing Comment

by:helpchrisplz
ID: 38361823
That's great thank you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, I will share you some basic tips for content marketing and to rank your website on Google.
We take a look at the fast-evolving changes in Search Engine Optimization rules and algorithms by Google.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Suggested Courses
Course of the Month13 days, 5 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question