Forum Moderators: phranque
I want to redirect example.com to example.dk/en/. Currently i use the following in my .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule ^(.*)$ http://www.example.dk/en/ [R=301,L]
It works in Firefox but not in IE. When i open IE and go to domain.com i get a 404 error page. If i have already visited example.dk and then visit example.com i am redirected correctly to example.dk/en/.
If i look at the http header i receive when i visit example.com it looks like the following.
HTTP/1.1 301 Moved Permanently =>
Date => Wed, 31 May 2007 21:24:07 GMT
Server => Apache
Location => http://www.example.dk/en/
Content-Length => 299
Connection => close
Content-Type => text/html; charset=iso-8859-1
Any ideas of what is wrong?
[edited by: jdMorgan at 3:34 pm (utc) on June 10, 2007]
[edit reason] example.com [/edit]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule (.*) http://www.example.dk/en/$1 [R=301,L]
Always completely flush your browser cache --delete IE "Temporary Internet Files"-- after changing anything in your server configuration in .htaccess or any other server config file. Otherwise, your browser will serve you a previously-cached copy of the requested page, and will not send a request to your server. If that happens, then the code on your server can have no effect. It's likely that IE is just serving you a copy of the data it cached for example.com/ *before* you installed the redirect.
Jim
I actually have tried to delete all temporary internet files in IE, but that doesn't seem to help. Its only IE7 i have seen the problem. Maybe it could be some security thing?
Do you know any service which can give me all the header information so that i could try to post it to this thread? (I assume that i cannot send a link to my domain)
Again, unless you are detecting the browser user-agent with some other server-side code, the client you use won't make any difference to the server, as long as the client actually sends the request to the server. If your browser is serving a cached response, then it won't send the request.
You may also have a caching proxy in the network between you and your server, and that may also interfere. Try accessing the site (get a 404), then clear the Temp files using IE7's Tools->Internet Options->General->Browsing History->Delete->Delete Files, then force a page reload with Ctrl-F5, in that order. If this is a cache problem, then once that is done you should have no further trouble.
Look at your server access log: Are you seeing these 404'ed requests in the log? If not, then it is certainly a caching problem.
I suspect that if it were a "security problem" with IE7, then IE7 would pop an error message, and you wouldn't see a 404 in the browser.
Jim