Solved

htaccess 404 redirect help in IE

Posted on 2012-03-16
5
420 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Powershell GUI 11 66
Link Anchor Not working 9 51
Select String - If Else Statement - Powershell 8 29
BatchFile-Disk Detection 23 32
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

696 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