views:

11

answers:

2

Hey,

I have made a .htaccess that I've used on all hosts up until this one to rewrite index.html to the root domain.

This is the code

Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.domain.co.uk/ $1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.domain.co.uk/ $1 [R=301,L]

RewriteEngine on
RewriteBase /
RewriteRule ^index\.(htm|html|php) http://www.domain.co.uk/ [R=301,L]
RewriteRule ^(.*)/index\.(htm|html|php) http://www.domain.co.uk/$1/ [R=301,L] 
RewriteCond %{HTTP_HOST} ^domain\.co.uk 
RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [R=permanent,L]

But alas it will not work on vidahost.com when they are still supposedly same server and this code has worked on servers for years so I doubt it's an out of date server upgrade problem.

They can't do it either and I'm stuck. All help thanked in advance.

A: 

This could be an Apache configuration issue -- you have to be permitted to use mod_rewrite in the main Apache configuration.

Also, RewriteEngine should typically be before any other mod_rewrite commands, though if it was working for you before, maybe that's not the issue here.

Andrew
Cool but the rewrite rule to make the hostname www is working just not the rule to make index.html direct to root.
Mark
@Mark I'm suspicious of the location of your RewriteEngine and RewriteBase directives. What changes if you put them at the beginning? Also, what happens if you change RewriteBase to the physical path to your web directory (maybe /home/accountname/public_html or the like)?
Andrew
I added a index.php and it worked. Seems that it was ignoring the .html file. thanks everyone.
Mark
A: 

Well, first, you should post virtual host configuration and also you can enable mode rewrite debugging.

RewriteLog path-to-log-file
RewriteLogLevel number-0-9- /zero is disabled/

It can help you to find out what wrong is.

Ency