mod_rewrite fails on MSIE, works on Firefox

Discuss practical ways rearrange URLs using mod_rewrite.

mod_rewrite fails on MSIE, works on Firefox

Postby bookstack » Fri Nov 03, 2006 8:01 am

This is quite a weired problem:

the site is :
http://www.kunxi.org/gallery/

Firefox works fine with the mod_rewrite, however, MSIE get 404 Error.

The gallery program is zenphoto 1.0.3, installed in /gallery. Here is the /gallery/.htaccess:
Code: Select all
<IfModule mod_rewrite.c>

RewriteEngine On
# !!! Change this to the web path (eg: http://www.example.com/photos --> /photos) !!!
RewriteBase /gallery

RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule ^.*$ - [R,L]

RewriteRule ^admin/?$                        zen/admin.php [R,L]

RewriteRule ^page/([0-9]+)/?$              index.php?page=$1 [L,QSA]
RewriteRule ^([^/]+)/?$                    index.php?album=$1 [L,QSA]
RewriteRule ^([^/]+)/page/([0-9]+)/?$      index.php?album=$1&page=$2 [L,QSA]
RewriteRule ^([^/]+)/image/(thumb|[0-9]{1,4})/([^/\\]+)$    zen/i.php?a=$1&i=$3&s=$2 [L,QSA]
RewriteRule ^([^/]+)/image/([^/\\]+)$      albums/$1/$2 [L]
RewriteRule ^([^/]+)/([^/\\]+)$            index.php?album=$1&image=$2 [L,QSA]

</IfModule>


And the root is wordpress with mod_rewrite rules:
Code: Select all
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


Help is wanted, thank you.
bookstack
 
Posts: 3
Joined: Fri Nov 03, 2006 7:59 pm

Postby richardk » Sun Nov 05, 2006 8:07 am

Try this in a .htaccess file in your document root. Don't put a .htaccess file in the gallery/ directory.

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^gallery(/.*)?$ - [L]

RewriteRule ^gallery/admin/?$                                  /gallery/zen/admin.php               [R,L]
RewriteRule ^gallery/page/([0-9]+)/?$                          /gallery/index.php?page=$1           [QSA,L]
RewriteRule ^gallery/([^/]+)/?$                                /gallery/index.php?album=$1          [QSA,L]
RewriteRule ^gallery/([^/]+)/page/([0-9]+)/?$                  /gallery/index.php?album=$1&page=$2  [QSA,L]
RewriteRule ^gallery/([^/]+)/image/(thumb|[0-9]{1,4})/([^/]+)$ /gallery/zen/i.php?a=$1&s=$2&i=$3    [QSA,L]
RewriteRule ^gallery/([^/]+)/image/([^/]+)$                    /gallery/albums/$1/$2                [QSA,L]
RewriteRule ^gallery/([^/]+)/([^/]+)$                          /gallery/index.php?album=$1&image=$2 [QSA,L]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule . /index.php [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby bookstack » Mon Nov 06, 2006 8:03 pm

Thank you Richardk, I update the /root/.htaccess, and delete /root/gallery/.htaccess, since Options is disabled in my ISP, I have to comment the first Option ... line.

However, the IE still issue 404 error, while Firefox works fine.
bookstack
 
Posts: 3
Joined: Fri Nov 03, 2006 7:59 pm

Postby bookstack » Mon Nov 06, 2006 8:03 pm

In fact, I doubt maybe the mime is messed up, but no idea how to debug the mime header information.
bookstack
 
Posts: 3
Joined: Fri Nov 03, 2006 7:59 pm

Postby richardk » Tue Nov 07, 2006 8:30 am

Ask your host. They're (almost certainly) setting the mime type.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 5 guests

cron