Forum Moderators: phranque
This is what I have so far
# MS Internet Explorer - Mozilla v4
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4(.*)MSIE
RewriteRule ^index\.html$ /v20.html [L]# All other browsers
RewriteRule ^index\.html$ /v21.html [L]
This works just fine except for one small problem.
If a user hits www.domain.com instead of www.domain.com/index.html they don't get the relevant page.
Those that hit www.domain.com/index.html get the correct page - no problem.
However as I will be using an iframe on those pages (v20.html and v21.html) then I'd be happy if all pages got directed to v20 or v21
I guess what I'm trying to say is can the rules above be written more like this?
# MS Internet Explorer - Mozilla v4
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4(.*)MSIE
RewriteRule <anyfile>$ /v20.html [L]# All other browsers
RewriteRule <anyfile>$ /v21.html [L]
Kia
**edit to add**
I don't mind the user seeing v20.html/v21.html in the adress bar - it doesn't need to be hidden.
[edited by: JustKia at 4:26 pm (utc) on Oct. 19, 2007]
Domain.com is the single most important URL a site has - and will ever have. Easier to remember, easier to spell, easier to get links to, a permanent, central focus for SEO .... and so on.
It's almost invariably better to be directing visitors TO domain.com - not away from it.
If the user is using IE 5.5/6 then I need them to get a different page to those using Firefox.
I have the .htaccess that will rewrite index.html to either v20.html or v21.html
However when the user types in www.domain.com the .htaccess file does NOT work.
If the user types in www.domain.com/index.html the .htaccess does work.
But most users don't type in the index.html part of an url.
So I need help with editing the .htaccess file so that I can deliver the right pages to the right people =)
Which way it's done I don't mind.
The site is basically to be a storage site for recipes that are shared through a yahoo mailing list.
Yes I know yahoo archives, but I have a specific layout that I want (women eh?) and I have other stuff I want to add.
My problem is that with the current .htaccess it only works if the user types in www.domain.com/index.html which of course most users do not.
So, I'm looking to fix my .htaccess so that it will work when the user goes to www.domain.com whereas at the moment it only works if the user goes to www.domain.com/index.html
Ideally if the user its ANY page it will give them v20.html or v21.html (based on their browser) as the content pages are called into an iframe and shouldn't be viewed alone, but won't be disasterous if they do.
[edited by: JustKia at 5:55 am (utc) on Oct. 20, 2007]
In your rewrite, the RewriteCond just needs to test for %{REQUEST_URI} being / as well as your existing condition, and only those, and you have cracked it.
If it tested for either / or for /index.html then you would be promoting two URLs for the same content; Duplicate Content. Try to avoid that. Test only for a filepath of "/" in the rewrite request.
So, before the rewrite you need two further rules. You need to redirect (301) requests for all non-www to www for all files on the site, and before that you need a to have a specific 301 redirect for any (www or non-www) /index.html to be redirected to www.domain.com/ too.
I can't seem able to get the
RewriteRule ^index\.html$ /v20.html [L]
RewriteRule ^index\.html$ /v21.html [L]
to test for just / rather than index.html
I've tried
^/$ - gives 500 error
^(.*)/$ - gives 500 error
tried a few other things similar but got 500 errors.
^domain\.com$ - doesn't give the user the v20 or v21 page
^domain\.com/$ - doesn't give the user the v20 or v21 page
I guess I'm missing something basic but I keep giving myself 500 errors.