Solved

htaccess 404 redirect help in IE

Posted on 2012-03-16
5
408 Views
Last Modified: 2012-03-20
I am trying to get my .htaccess file to work with IE. It seems to work for with FF. Here is what I have:

ErrorDocument 404 /404.html

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L] 
</IfModule>

Open in new window

0
Comment
Question by:BDC-Net
  • 2
  • 2
5 Comments
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 333 total points
ID: 37730941
.htaccess has absolutely zero to do with browsers.  it resides on the server, is executed by the server and it is totally transparent to the browser.

What is it you are trying to do?


Cd&
0
 
LVL 2

Author Comment

by:BDC-Net
ID: 37730959
Here is the site I am working on: http://www.artizantile.com

I want to keep the domain with www. and I want it to redirect to a 404.html page when someone types in a url that doesn't exist.

Any help would be appreciated.

Thanks
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 333 total points
ID: 37731039
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^artizantile.com[nc]
RewriteRule ^(.*)$ http://www.artizantile.com/$1 [r=301,nc]
ErrorDocument 404 404.html

Open in new window



Cd&
0
 
LVL 2

Author Comment

by:BDC-Net
ID: 37731051
Do I need to surround this with <IfModule mod_rewrite.c> and  </IfModule>?
0
 
LVL 10

Accepted Solution

by:
Gregg earned 167 total points
ID: 37731606
Do I need to surround this with <IfModule mod_rewrite.c> and  </IfModule>?
You do not;...i think.  to what i can see _ i believe at the very least the conditional statement and redirect are right format. Have you tried to clear cache in IE to reflect new changes? Cd& is extremely knowledgeable - have you tried his suggestion? My only concern is adding [L] flag for a stop.

You might also account for index.html. This works for me. But i have my rewrites at a global scope:
RewriteRule ^/index\.html$ http://www.mysite.com [R=301,L]

So for htaccess, i think the initial slash in pattern is removed:
RewriteRule ^index\.html$ http://www.mysite.com [R=301,L]
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Column Spacing 3 36
Flexbox in CSS3 2 26
Element alignment and word wrapping 9 25
Bootstrap 3 icons 3 11
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now