views:

92

answers:

2

So http://myopicvoid.org/ when loaded in Firefox or Chrome, automatically redirects to http://myopicvoid.org/main as well it should, but not in IE8. What exactly would cause this? My .htaccess is as follows:

Options +FollowSymlinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^myopicvoid\.org$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule / /main [r=301,L]

RewriteCond %{HTTP_HOST} ^myopicvoid\.org$
RewriteCond %{REQUEST_URI} !^/script/.*
RewriteCond %{REQUEST_URI} !^/style/.*
RewriteRule ^(.*)$ /script/$1.py [L]

There exists a main.py in /script, but I'm met with Error 404 Not Found (script not found or unable to stat: script/.py) in IE. Help?

A: 

Off the top of my head - maybe the URL http://myopicvoid.org/ has the trailing slash removed when you make the request from certain browers? This would prevent the "/" from matching the first RewriteRule.

scraimer
+2  A: 

I would recommend changing

RewriteCond %{HTTP_HOST} ^myopicvoid\.org$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule / /main [r=301,L]

To:

RewriteCond %{HTTP_HOST} ^myopicvoid\.org$
RewriteRule ^/?$ /main [r=301,L]

So, what I've done is removed the condition, but made the rule only match either nothing, or just a single fore-slash. The condition wasn't really necessary; it's important to note that mod_rewrite processes rules first, then checks to see if they meet their conditions, so this should be a tiny bit more efficient.

This will be a little more forgiving if the request does not include the trailing slash.

jason