Redirecting when there is no album with htaccess or another way?

Visitmedia

Joined: 2014-08-15
Posts: 4
Posted: Wed, 2014-08-20 15:34

Hello everybody,

a few months ago i have updated an old gallery1 to a gallery3. Because of several Problems the mappath does not seem to work and i dont know why. So here is my problem:

The old Gallery 1 link is:
http://www.docu-and-info.de/gallery/album47

if you try to open it you get this:
http://www.docu-and-info.de/gallery3/g1/map?path=album47

where the page tells you that there was no mathing gallery for your request. It should map here:
http://www.docu-and-info.de/gallery3/ht_motor_modell/album47

So i thought i could map this with a simple htaccess modification but this does not work. I tried several things like:

RewriteRule ^gallery/album47/(.*)$ /ht_motor_modell/album47/$1 [R=301,NC,L]

or:
Redirect permanent http://www.docu-and-info.de/gallery/album47 http://www.docu-and-info.de/gallery3/ht_motor_modell/album47

or:
Redirect 301 http://www.docu-and-info.de/gallery/album47 http://www.docu-and-info.de/gallery3/ht_motor_modell/album47

or even as a mod_rewrite Rule. But the htaccess does not seem to provide my request. Everytime i open up the first link i get the page which tells me, that there was no matching album and i should log in. Is there any way to get the old links working?

Thanks in advance!

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sun, 2014-08-24 20:03

There's obviously some issue with the way the import module created the map file--or maybe you've placed the htaccess in the wrong directory?

Anyhow, if you're placing the rule in your /gallery/ directory, try:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^gallery/(.*)$ http://www.docu-and-info.dr/gallery3/ht_motor_modell/$1 [R=301,NC,L]

If you're placing the rule in your /gallery3/ directory, try:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^gallery3/g1/(.*)$ http://www.docu-and-info.dr/gallery3/ht_motor_modell/$1 [R=301,NC,L]

I'm not sure what other htaccess goodness you have running. Other rules could easily conflict. Report back.

 
Visitmedia

Joined: 2014-08-15
Posts: 4
Posted: Mon, 2014-08-25 12:22

Hello,

thanks for your info. It does not help at all. Here is my whole htaccess. Maybe there is something else wrong.

Quote:
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

<IfModule mod_php5.c>
php_flag short_open_tag On
php_flag magic_quotes_gpc Off
php_flag magic_quotes_sybase Off
php_flag magic_quotes_runtime Off
php_flag register_globals Off
php_flag session.auto_start Off
php_flag suhosin.session.encrypt Off
php_value upload_max_filesize 20M
php_value post_max_size 100M
</IfModule>

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

<FilesMatch ".album.jpg">
Order deny,allow
</FilesMatch>

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^gallery3/g1/(.*)$ http://www.docu-and-info.dr/gallery3/ht_motor_modell/$1 [R=301,NC,L]
RewriteBase /gallery3
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^index.php/(.*) $1 [QSA,R,L]
</IfModule>

i also do not have a folder "g1" in my gallery 3 installation. Maybe this causes the problem?

Thanks for your help

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Tue, 2014-08-26 16:00

That is in the /gallery3/ folder?
And there's a different htaccess in the root folder?

Looking back, even if it redirected, it wouldn't have done to the proper page anyway. (Oops)

Try moving the RewriteBase line up a line, and change the next line to these two:

RewriteCond %{QUERY_STRING} path=(.*) [NC]
RewriteRule ^gallery3/g1/map$ http://www.docu-and-info.dr/gallery3/ht_motor_modell/%1 [R=301,NC,L]

EDIT:

Visitmedia wrote:
i also do not have a folder "g1" in my gallery 3 installation. Maybe this causes the problem?

That may be part of your original issue, but I've never imported/migrated a Gallery directly, so I'm not 100% sure. It DOES look like Gallery expects a g1 directory that maybe has an htaccess file with map rules?

 
Visitmedia

Joined: 2014-08-15
Posts: 4
Posted: Sat, 2014-08-30 16:14

In the root there is no htaccess. I have copied the rewrite rules as you mentioned but it still does not help at all. The gallery does not redirect anything. There also is no folder "g1" in my installation. I just have application, bin, installier, lib, modules, system, themes and var. Then there is the .htaccess and an index.php

Here is my htacces as it is right now. I have corrected the domain in your two lines.

Quote:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /gallery3
RewriteCond %{QUERY_STRING} path=(.*) [NC]
RewriteRule ^gallery3/g1/map$ http://www.docu-and-info.de/gallery3/ht_motor_modell/%1 [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^index.php/(.*) $1 [QSA,R,L]
</IfModule>

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sun, 2014-08-31 19:25

Regardless of whether the code I posted works, there are definitely more htaccess redirects somewhere.

Anyway, you could try

RewriteCond %{QUERY_STRING} ^path=(.*)$ 
RewriteRule ^(.*)/g1/map(.*) http://www.docu-and-info.de/gallery3/ht_motor_modell/%1 [R=301,NC,L]

but I'm really shooting in the dark here (and that code overstretches a bit).

Also, check to be if the redirect isn't being applied, or if it's being applied, but resulting in a separate 404.

 
Visitmedia

Joined: 2014-08-15
Posts: 4
Posted: Wed, 2014-09-03 19:18

Ok i found my problem.

Now the link works. I have updated my gallery3 version to the latest. Here i didnt install the gallery1 module. WIthout this module the redirections does not work. So now everything is fine and works again.

Thanks for your help anyway.

I have spent hours on this xD