Forum Moderators: phranque

Message Too Old, No Replies

htaccess not working on IE

         

JohnWinch

2:54 pm on Jan 26, 2015 (gmt 0)

10+ Year Member



Hello,

I want to redirect all the files that start with a "a" to an other site, here's my code:

RedirectMatch 301 /a(.*)\.html$ http://www.example.com/a.html


It's working fine on chrome but not on IE, is there something missing?

Thanks for your help!

Best regards,

[edited by: engine at 3:54 pm (utc) on Jan 26, 2015]
[edit reason] please use example.com [/edit]

topr8

4:00 pm on Jan 26, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



empty the cache on IE

it is impossible that it works in one browser and not the other.
change the settings in IE to retrieve the page every time while you are testing.

JohnWinch

4:54 pm on Jan 26, 2015 (gmt 0)

10+ Year Member



I've clean the IE cache and it's still not working

lucy24

10:07 pm on Jan 26, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



OK, let's get some details about what "not working" means. Look at your raw logs. Are requests being received? Along with emptying the cache, re-loading the page often works. What happens in browsers you don't normally use, that have nothing cached for this request?

Incidentally: does your htaccess contain any mod_rewrite directives (RewriteRule), or is it strictly mod_alias (Redirect by that name)?

JohnWinch

12:28 am on Jan 27, 2015 (gmt 0)

10+ Year Member



here's my full code:

RewriteEngine On

RedirectMatch 301 /a(.*)\.html$ http://www.newsite.com/a.html

phranque

12:30 am on Jan 27, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, JohnWinch!


htaccess not working on IE

all the .htaccess action happens on the web server - the browser cannot see this file.
while it is possible to have browser-specific behavior in .htaccess, you can't do it with mod_alias directives.
it is more likely some type of caching behavior.

have you checked your web server access log file and verified the request from your IP and your UA?

phranque

12:33 am on Jan 27, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



RewriteEngine On

this is irrelevant without other mod_rewrite directives.

RedirectMatch 301 /a(.*)\.html$ http://www.example.com/a.html

this is a mod_alias directive.


IMPORTANT: Please Use example.com For Domain Names in Posts:
http://www.webmasterworld.com/apache/4452736.htm [webmasterworld.com]

JohnWinch

12:40 am on Jan 27, 2015 (gmt 0)

10+ Year Member



how to rewrite it without the mod_alias then?

lucy24

1:49 am on Jan 27, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What happens when you request the page in MSIE as opposed to what happens in other browsers? "What happens" means two things: what do you personally see in the browser, and what do you see in your logs? The key question is whether the request is being received, and what happens afterward.

how to rewrite it without the mod_alias then?

You may have misunderstood the question. In Apache there are two basic ways of issuing a redirect. The user doesn't know how you did it; they only see the 301.

If you have no RewriteRules in your htaccess, than you can and should stick with mod_alias (RedirectMatch, in this case). You do not need the line "RewriteEngine on" because it has no effect.

If you have any RewriteRules, then you cannot use mod_alias and will need to change any existing redirects. ("Cannot" = it is physically possible, but is likely to have unintended consequences.)

JohnWinch

1:51 am on Jan 27, 2015 (gmt 0)

10+ Year Member



I have no rewrite rules, the sole purpose of this htacces is to redirect all file that start with a "a".

where can I check the log for that in cpanel?

JohnWinch

8:25 pm on Jan 28, 2015 (gmt 0)

10+ Year Member



No idea anyone? :)

not2easy

9:08 pm on Jan 28, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



where can I check the log for that in cpanel?

Your access logs can be downloaded via ftp or in the ControlPanel, under "Logs" click on "Raw Access Logs".