Announcement

#1 2014-09-06 02:34:18

Tequila
Member
2014-09-06
15

[resolved] SEO-friendly URLs won't work

Hello,

I tried to implement SEO-friendly URLs, but I have some issues. I've looked through previous forum posts and I couldn't find a solution.

Everything is working fine with my piwigo gallery except for the absence of the question mark in urls. If question_mark_in_urls is false, as stated in your SEO URLs directions, my gallery home page is displayed correctly but links all over homepage won't work properly. A white page containing a header and a left menu only with no template design and css is displayed. Neither error messages nor content images are displayed. I tried with different themes and different browsers and the issue remains.

If I introduce a question mark in any of the URLs manually, that page is displayed correctly as expected but page links won't work. A white page containing a header and a left menu only with no template design is displayed from any link.

Any idea?


1and1 Hosting
Piwigo 2.6.3
Apache 2.2.16
PHP 5.5.16
mysql 5.0.11-dev
Directory /photos

#htaccess piwigo
AcceptPathInfo On
Options +MultiViews

<?php
$conf['question_mark_in_urls'] = false;
$conf['php_extension_in_urls'] = false;
$conf['category_url_style'] = 'id-name';
$conf['picture_url_style'] = 'file';
?>

Last edited by Tequila (2014-09-06 19:09:09)

Offline

 

#2 2014-09-08 22:43:57

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

I reviewed site log files and I detected the following issue:

If I insert a question mark in the URL manually, link does work and I get the following log entries:

GET /photos/index?/category/1-products HTTP/1.1
GET /photos/_data/combined/p1iixz.js HTTP/1.1

If I don’t insert the question mark manually, link doesn’t work and I get the following log entries:

GET /photos/index/category/1-products HTTP/1.1
GET /photos/index/category/_data/combined/p1iixz.js HTTP/1.1

Obviously there is no /photos/index/category/ directory.

Maybe the server isn’t  translating PATH_INFO variable but I do have the following configuration:

In local/config/config.inc.php, $conf['question_mark_in_urls'] = false;
In htaccess, AcceptPathInfo On

1and1 confirmed that  apache AcceptPathInfo directive is active.

Any idea what is causing this?

Offline

 

#3 2014-09-09 07:04:48

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

If I turn SEO-friendly URLs off, everything works fine and I get the following logs:

GET /photos/index.php?/category/1 HTTP/1.1
GET /photos/_data/i/upload/2014/09/03/*.jpg HTTP/1.1
GET /photos/themes/default/js/switchbox.js?v2.6.3 HTTP/1.1

GET /photos/index.php?/category/2 HTTP/1.1
GET /photos/_data/i/upload/2014/09/04/*.jpg HTTP/1.1
GET /photos/themes/default/js/switchbox.js?v2.6.3 HTTP/1.1

GET /photos/picture.php?/19/category/2 HTTP/1.1
GET /photos/_data/i/upload/2014/09/04/*.jpg HTTP/1.1
GET /photos/themes/elegant/icon/none.png HTTP/1.1

If I turn SEO-friendly URLs on, links don't work and I get the following logs:

GET /photos/index/category/_data/combined/obi76i.css HTTP/1.1
GET /photos/index/category/themes/default/js/switchbox.js?v2.6.3 HTTP/1.1

Any help would be appreciated.

Offline

 

#4 2014-09-11 04:15:07

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

I increased file permissions on every piwigo's directory and file to 750, even to 777, and the issue remains.

Offline

 

#5 2014-09-11 04:54:10

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

If both question_mark_in_urls and php_extension_in_urls are true, the category page generated is displayed correctly and its code contains the following link:

<link rel="canonical" href="index.php?/category/1">

If question_mark_in_urls is true and php_extension_in_urls is false, the category page generated is displayed correctly and its code contains the following link:

<link rel="canonical" href="index?/category/1">

If both question_mark_in_urls and php_extension_in_urls are false, the category page generated shows a blank page with a left menu only and its code contains the following link:

<link rel="canonical" href="/photos/index.php/category/">

In this last case, page code contains some links with 'index/category/1' and some links with '/photos/index.php/category/', such as the canonical link.

Any help would be appreciated.

Offline

 

#6 2014-09-11 08:52:05

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] SEO-friendly URLs won't work

Hello
great investigation
unfortunately we are currently working hard on the 2.7. We don't forget you ;-)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2014-09-13 01:52:00

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

flop25, thank you for your concern about this issue.

Offline

 

#8 2014-09-13 03:09:38

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

I have a shared hosting server and PHP runs as a CGI script.

Server API: CGI/FastCGI

While searching for a solution, I found the following advices on the Internet:

1) $_SERVER['REDIRECT_URL'] is only available on some servers in some cases. Use $_SERVER['REQUEST_URI'] instead.

2) If PHP is being run as a CGI binary (and not an Apache module) then I don't believe it's possible for you to access such items as $_SERVER['REDIRECT_URL']. When PHP is run as a CGI binary, the parser is executed as a separate process - it's not linked with the Apache worker process in any direct way, thus it can't retrieve some information internal to Apache.

Based on this information, I replaced all $_SERVER['REDIRECT_URL'] with $_SERVER['REQUEST_URI'] in piwigo's functions_cookie.inc.php script. Now, as $conf['php_extension_in_urls'] is false, .php extension no longer appears in URLs but the issue remains.

I will continue with the investigation until I find the solution as the piwigo gallery is worth using.

Offline

 

#9 2014-09-17 05:10:24

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

I made three minor code changes and the gallery is now partially working as expected. Home page is displayed correctly and some of its links are working fine. First level albums do show information correctly in a blank page, but the images and template design is missing. Applications such as tags.php, search.php, comments.php, about.php and notification.php do work fine.

I hope to find a final solution in the following days.

Offline

 

#10 2014-09-24 06:20:24

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

Voilà!

My Piwigo gallery is now working as expected.

I applied the following fixes:

1) PATH_INFO is undefined on my shared hosting server and was replaced by ORIG_PATH_INFO in section_init.inc.php and functions_cookie.inc.php.

2) At the home page ORIG_PATH_INFO took the value of "/photos/index.php", so in this case $page['root_path'] should take the value of PHPWG_ROOT_PATH in section_init.inc.php.

3) Home Page link did not work and it was necessary to include $conf['gallery_url']='http://www.mysite.com/photos/' in config.inc.php.

4) Icons (such as download and slideshow tools) did not show, then PATH_INFO must be replaced by ORIG_PATH_INFO in functions_cookie.inc.php.

5) I do not know if PATH_INFO must be also replaced by ORIG_PATH_INFO in common.inc.php (I did not apply this fix).

That's it, Piwigo gallery is now running fine on my 1and1 shared hosting server.

Offline

 

#11 2014-09-24 09:34:46

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] SEO-friendly URLs won't work

could you isntall a raw Piwigo beside your current one and try to use  cgi.fix_pathinfo = 1 in your php.ini , plz ? thx


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#12 2014-09-24 22:17:38

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

flop25,

I did a fresh install of Piwigo 2.6.3 and Piwigo 2.7. Then I added cgi.fix_pathinfo = 1 to php.ini in both directories as instructed by you. It didn't work, the issue remains in both new installations.

Piwigo 2.7 is producing a different issue. I can't even add a new album because the link doesn't work. Here you will find the specific line within page code:

<a href="#" id="addAlbumOpen">create a new album</a>

Offline

 

#13 2014-09-29 04:45:05

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

Piwigo 2.7 is now working fine on my 1and1 shared hosting server after applying the following two patches:

1) PATH_INFO is undefined on my shared hosting server and was replaced by ORIG_PATH_INFO in section_init.inc.php and functions_cookie.inc.php.

2) At the home page ORIG_PATH_INFO took the value of "/photos/index.php", so in this case $page['root_path'] should take the value of PHPWG_ROOT_PATH in section_init.inc.php.

That's all I applied to get Piwigo 2.7 running fine and this is the versión I will be using for my Project.

config_default.inc.php content:

<?php
$conf['question_mark_in_urls'] = false;
$conf['php_extension_in_urls'] = false;
$conf['category_url_style'] = 'id-name';
$conf['picture_url_style'] = 'file';
?>

PHP.ini file:

[Date]
date.timezone = America/Mexico_City

htaccess file:

#htaccess piwigo
AcceptPathInfo On
Options -Indexes +MultiViews

Offline

 

#14 2014-09-29 08:05:11

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] SEO-friendly URLs won't work

Hi
could you kindly open a ticket in our bug tracker about Path_info.? So we don't forget to fix
thanks a lot for your efforts and contributions
http://piwigo.org/bugs/


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#15 2014-10-02 20:42:19

Tequila
Member
2014-09-06
15

Re: [resolved] SEO-friendly URLs won't work

I open a ticket already (ID 0003151).
Thanks flop25 for your concern about this issue.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact