Solved

htaccess 404 redirect help in IE

Posted on 2012-03-16
5
412 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
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 invoke it on a web page. 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.: (CODE)

911 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

25 Experts available now in Live!

Get 1:1 Help Now