Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Redirection issues  (Read 4277 times)

0 Members and 1 Guest are viewing this topic.

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #1 on: February 12, 2014, 04:28:42 pm »

the images that redirect have google path: furl=...allvip.us

the images that don't redirect have google path: furl=...www.allvip.us

Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #2 on: February 12, 2014, 04:57:10 pm »

Is working now.
I deleted the www. from .htaccess file.

I replaced:

Code: [Select]
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?allvip.us [NC]   
RewriteRule ^(.*\.(jpg|jpeg|png|gif))$ http://www.allvip.us/gallery/redirect.php?$1 [NC,R,L]

with:

Code: [Select]
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?allvip.us [NC]   
RewriteRule ^(.*\.(jpg|jpeg|png|gif))$ http://allvip.us/gallery/redirect.php?$1 [NC,R,L]

Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #3 on: February 12, 2014, 05:11:04 pm »

Maybe this happens because my host provider redirects allvip.us to www.allvip.us
They said they have to do that because my gallery takes to much cpu or something and I should have my website working under CloudFlare.

CloudFlare - A type records (without www) cannot be directly routed though the CloudFlare network so they redirect allvip.us to www.allvip.us
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #4 on: February 12, 2014, 07:08:48 pm »

Deleteing the www. is not a good ideea.

All the gallery works without www. http://allvip.us/gallery/displayimage.php?pid=6198 not http://www.allvip.us/gallery/displayimage.php?pid=6198.

I put back the www. and is working fine.
I don't know why sometimes is not working.
I thing is a CloudFlare problem.Sometimes images don't even show on the page if CloudFlare is on.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #5 on: February 12, 2014, 07:21:58 pm »

The redirect script works as expected, so you should ask your hosting provider for support regarding the cloud issue.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #6 on: February 12, 2014, 07:59:28 pm »

Yes.I know that.
I forgot to say in my last message that I will solve the problem with CloudFlare and the host.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #7 on: February 13, 2014, 08:13:14 am »

I can help wonder if the code is ok
Code: [Select]
header("Location: displayimage.php?pid=".$pid);
Should " be after $pid?
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #8 on: February 13, 2014, 08:51:39 am »

I have a .htaccess file with a simple rule provide by the host to redirect NON www to www in allvip.us root:

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.allvip.us
RewriteRule (.*) http://www.allvip.us/$1 [R=301,L]

works fine on allvip.us/cpg/test and even on allvip.us/gallery but if the .htaccess for redirect.php is in allvip.us/gallery folder all the gallery pages without www will not redirect to www.

Something in the .htaccess form allvip.us/gallery folder that overides the rule NON www to www.

I have 24 hours with no sleep and I still don't know what is it.

all my domains are deleted from CloudFlare.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #9 on: February 13, 2014, 09:02:50 am »

Should " be after $pid?
No. Of course it would also work if you re-structure it, but as I already said, the script works as expected.


Something in the .htaccess form allvip.us/gallery folder that overides the rule NON www to www.
Feel free to use the example from our docs: http://documentation.coppermine-gallery.net/en/bridging.htm#integrating_subdomain_www
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #10 on: February 13, 2014, 09:31:37 am »

the code from the docs redirect www to NON www

My rule redirects NON www to www.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Re: hotlinking to redirect to the page that contains the image
« Reply #11 on: February 13, 2014, 09:41:53 am »

I changed the code from the docs:

Code: [Select]
RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.allvip\.us$ [NC]
    RewriteRule ^(.*) http://allvip.us/$1 [R,L]

to:

Code: [Select]
RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.allvip\.us$ [NC]
    RewriteRule ^(.*) http://www.allvip.us/$1 [R,L]

I added the ! on the first line and www on the second and it works but non on allvip.us/gallery because of the htaccess for redirect.php.

When I delete the .htaccess from gallery folder all the riderect rules I find are working.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Redirection issues
« Reply #12 on: February 13, 2014, 10:19:50 am »

I just splitted your recent posts, as they're not related to the initial topic.

So you currently have issues with a htaccess file. Unfortunately I cannot track what the actual issue is. It seems you have different htaccess files for different purposes. Then, suddenly something else doesn't work as expected, but 5 minutes later this information is obsolete.

So please describe exactly what doesn't work. Post links! Post the content of the involved htaccess files. Describe how it is supposed to work.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Redirection issues
« Reply #13 on: February 13, 2014, 10:53:02 am »

under allvip.us I have an .htaccess to redirect all the pages allvip.us/... to www.allvip.us/....:

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.allvip.us
RewriteRule (.*) http://www.allvip.us/$1 [R=301,L]

under allvip.us/gallery I have another .htaccess,redirect.php and no_hotlinking.html:

Code: [Select]
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?allvip.us [NC]   
RewriteRule ^(.*\.(jpg|jpeg|png|gif))$ http://www.allvip.us/gallery/redirect.php?$1 [NC,R,L]

allvip.us/gallery does not redirects to www.allvip.us/gallery because of the second .htaccess.

If I delete the second .htaccess (from folder gallery) allvip.us/gallery riderects to www.allvip.us/gallery

I have another coppermine gallery with demos that works as axpected: allvip.us/cpg/test/  riderects to www.allvip.us/cpg/test/ on all the pages.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Redirection issues
« Reply #14 on: February 13, 2014, 10:57:35 am »

Try this for your .htaccess file in /gallery/:
Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.allvip.us
RewriteRule (.*) http://www.allvip.us/gallery/$1 [R=301,L]
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?allvip.us [NC]   
RewriteRule ^(.*\.(jpg|jpeg|png|gif))$ http://www.allvip.us/gallery/redirect.php?$1 [NC,R,L]
« Last Edit: February 13, 2014, 11:08:51 am by Αndré »
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Redirection issues
« Reply #15 on: February 13, 2014, 11:03:42 am »

Not Found

The requested URL /index.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.






Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Redirection issues
« Reply #16 on: February 13, 2014, 11:07:10 am »

allvip.us/gallery redirect to www.allvip.us

allvip.us/gallery/index.php redirects to http://www.allvip.us/index.php
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Redirection issues
« Reply #17 on: February 13, 2014, 11:09:21 am »

I just replaced
Code: [Select]
RewriteRule (.*) http://www.allvip.us/$1 [R=301,L] with
Code: [Select]
RewriteRule (.*) http://www.allvip.us/gallery/$1 [R=301,L] in my above code.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Redirection issues
« Reply #18 on: February 13, 2014, 11:23:50 am »

You are life saver all the time with a lot of patience  ;D

Thanks a lot.I can start CloudFlare now.CloudFlare has no point if users access the site without www.CoudFlare runs only for www.
Logged
Pages: [1]   Go Up
 

Page created in 0.133 seconds with 19 queries.