Multiple Subfolders - Different Result

Oh, the strange things mod_rewrite does!

Postby sharingsunshine » Wed Dec 24, 2008 3:51 pm

Hi Richard,

I turned on the log and there were 68 entries for the url I requested. The problem comes in when you look at the entries, I find there was more than one match.

I have upgraded a photo album and the rewrite was created automatically when I installed the s/w. The matches are coming from the upgraded .htaccess for the photo album. When I try to comment them out then the majority of my rewrites from the original .htaccess don't work.

So, even though the query string is still there it seems to redirect properly. I was concerned that it may not work down the road. However, to diagnose the upgraded rewrite code and the original photo album code would be a large task. Therefore, I appreciate your help and sorry I couldn't come to a complete resolve but to save your time I am going to let this go.

Thanks,

Randal
sharingsunshine
 
Posts: 55
Joined: Tue Dec 19, 2006 5:32 am

Postby richardk » Wed Dec 24, 2008 4:03 pm

What is the gallery mod_rewrite? Is it in the same .htaccess file as the redirect mod_rewrite?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby sharingsunshine » Wed Dec 24, 2008 6:43 pm

There is a mod_rewrite in the .htaccess located in the /gallery folder which is the old version. The code that is supplied is in the .htaccess located in the /gallery2.3 folder. Gallery2.3 is the folder the gallery operates out of now.

When I looked for the query I tested there were 6 matches and they all were in the gallery2.3 htaccess.

Here is the code on gallery2.3 that was supplied.

Code: Select all
# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On
RedirectMatch 301 ^/gallery2.3/(albums.php|index.html)$ /gallery2.3/main.php
    RewriteBase /gallery2.3/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery2.3\_remote2\.php
    RewriteCond %{REQUEST_URI} !/gallery2.3/main\.php$
    RewriteRule .   -   [L]

   RewriteCond %{THE_REQUEST} /gallery2.3/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2.3/main\.php$
    RewriteRule .   /gallery2.3/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,L]
    RewriteCond %{THE_REQUEST} /gallery2.3/v/([^?]+)\.davmount(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2.3/main\.php$
    RewriteRule .   /gallery2.3/main.php?g2_view=webdav.DownloadDavMount&g2_path=%1   [QSA,L]
    RewriteCond %{THE_REQUEST} /gallery2.3/w(/[^?]*)?(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2.3/main\.php$
    RewriteRule .   /gallery2.3/main.php?g2_controller=webdav.WebDav&g2_path=%1   [QSA,L]
    RewriteCond %{THE_REQUEST} /gallery2.3/v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/gallery2.3/main\.php$
    RewriteRule .   /gallery2.3/main.php?g2_path=%1   [QSA,L]
   
   RewriteCond %{QUERY_STRING} ^set_album(.+)$
RewriteRule ^.+$ /gallery2.3/main.php? [R=301,L]
</IfModule>

# END Url Rewrite section


Here are the matches that matched the query from the log file:

/private/var/tmp/folders.501/Cleanup At Startup/FtchBBTemp/rewrite_log.txt:2485: 0.0.0.0.0.0 - - [24/Dec/2008:15:48:35 --0700] [www.theherbsplace.com/sid#9dd0090][rid#a0090e8/initial] (4) RewriteCond: input='GET /gallery2.3/v/travel_7/chryslermuseum/IMG_7488.jpg.html?full=0 HTTP/1.1' pattern='/gallery2.3/v/([^?]+)(\?.|\ .)' => matched
/private/var/tmp/folders.501/Cleanup At Startup/FtchBBTemp/rewrite_log.txt:2486: 0.0.0.0.0.0 - - [24/Dec/2008:15:48:35 --0700] [www.theherbsplace.com/sid#9dd0090][rid#a0090e8/initial] (4) RewriteCond: input='/gallery2.3/v/travel_7/chryslermuseum/IMG_7488.jpg.html' pattern='!/gallery2.3/main\.php$' => matched


/private/var/tmp/folders.501/Cleanup At Startup/FtchBBTemp/rewrite_log.txt:2502: 0.0.0.0.0.0 - - [24/Dec/2008:15:48:35 --0700] [www.theherbsplace.com/sid#9dd0090][rid#a0728a0/initial/redir#1] (4) RewriteCond: input='GET /gallery2.3/v/travel_7/chryslermuseum/IMG_7488.jpg.html?full=0 HTTP/1.1' pattern='/gallery2.3/v/([^?]+)(\?.|\ .)' => matched


/private/var/tmp/folders.501/Cleanup At Startup/FtchBBTemp/rewrite_log.txt:2527: 0.0.0.0.0.0 - - [24/Dec/2008:15:48:38 --0700] [www.theherbsplace.com/sid#9dd0090][rid#a010100/initial] (4) RewriteCond: input='GET /gallery2.3/d/15104-2/IMG_7488.jpg HTTP/1.1' pattern='/gallery2.3/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)' => matched


/private/var/tmp/folders.501/Cleanup At Startup/FtchBBTemp/rewrite_log.txt:2528: 0.0.0.0.0.0 - - [24/Dec/2008:15:48:38 --0700] [www.theherbsplace.com/sid#9dd0090][rid#a010100/initial] (4) RewriteCond: input='/gallery2.3/d/15104-2/IMG_7488.jpg' pattern='!/gallery2.3/main\.php$' => matched


/private/var/tmp/folders.501/Cleanup At Startup/FtchBBTemp/rewrite_log.txt:2535: 0.0.0.0.0.0 - - [24/Dec/2008:15:48:38 --0700] [www.theherbsplace.com/sid#9dd0090][rid#a007a38/initial/redir#1] (4) RewriteCond: input='GET /gallery2.3/d/15104-2/IMG_7488.jpg HTTP/1.1' pattern='/gallery2.3/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)' => matched


I am sure you can figure it out but it may take more time than you can spare and I understand if it does.

Thanks,

Randal
sharingsunshine
 
Posts: 55
Joined: Tue Dec 19, 2006 5:32 am

Postby richardk » Fri Dec 26, 2008 9:59 am

There is a mod_rewrite in the .htaccess located in the /gallery folder which is the old version.

Do you still need that? It is the most likely cause of the error. If you still need it, post it's contents too, if not try removing it.

The code that is supplied is in the .htaccess located in the /gallery2.3 folder. Gallery2.3 is the folder the gallery operates out of now.

Are the redirects in your document root or /gallery/.htaccess?

Here is the code on gallery2.3 that was supplied.

That is unlikely to be causing a conflict as it specifically matches /gallery2.3 URLs.

That can probably be shortened to (but it's says automatically generated so if changed it will probably be replaced)
Code: Select all
# BEGIN Url Rewrite section
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^gallery2.3/(albums\.php|index\.html)$ /gallery2.3/main.php [R=301,L]

   RewriteCond %{QUERY_STRING} ^set_album(.+)$ [NC]
   RewriteRule . /gallery2.3/main.php? [R=301,L]

    RewriteCond %{SCRIPT_FILENAME} -f [OR]
    RewriteCond %{SCRIPT_FILENAME} -d [OR]
    RewriteCond %{REQUEST_URI} gallery2.3_remote2\.php
    RewriteRule . - [L]

    RewriteRule ^d/([0-9]+)-([0-9]+)/([^/?]+)$
/gallery2.3/main.php?g2_view=core.DownloadItem&g2_itemId=$1&g2_serialNumber=$2&g2_fileName=$3 [QSA,L]

    RewriteRule ^v/(.+)\.davmount$ /gallery2.3/main.php?g2_view=webdav.DownloadDavMount&g2_path=$1 [QSA,L]

    RewriteRule ^w(/.*)?$ /gallery2.3/main.php?g2_controller=webdav.WebDav&g2_path$1 [QSA,L]

    RewriteRule ^v/(.+)$ /gallery2.3/main.php?g2_path=$1 [QSA,L]
</IfModule>
# END Url Rewrite section
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby sharingsunshine » Fri Dec 26, 2008 10:24 am

the .htaccess is in /gallery

I cut off that .htaccess but because the majority of the urls are coming with /gallery/something_else they need that .htaccess that is located in the /gallery folder.

When it was turned off the redirects didn't work with anything that had /gallery in it.

The majority of our album links that are spidered already will have /gallery.

Thanks for sticking with this.

Randal
sharingsunshine
 
Posts: 55
Joined: Tue Dec 19, 2006 5:32 am

Postby richardk » Sun Dec 28, 2008 9:13 am

Please post the /gallery/.htaccess file and confirm the location of the redirects (document root or /gallery).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Previous

Return to Idiosyncrasies

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron