Solved

htaccess 404 redirect help in IE

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Select case on click 3 19
Awk : two files math 8 20
Insert Button on a table 16 36
Use Images instead of radio button and get the checked value and pass it to a h2 tag 3 17
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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