Gallery 3 SEO URL Optimization

webcyco

Joined: 2013-02-06
Posts: 1
Posted: Wed, 2013-02-06 05:48

Hello friends,

i have been trying since morning i am not able to solve this issue, i have searched and tried following links but still it is not working, may be i am not following order or something please check it and help me to resolve this issue.

Links that i have searched
http://www.milesjcarter.co.uk/blog/photos-on-the-web/gallery-3-seo-part-perfect-url-scheme/

http://forums.iis.net/t/1186418.aspx/1

And my website link which is not working
http://clickfreaky.com/pages/show/About+Freaky

And Here is my httaccess Code. I have copied my entire ht access file so that you can easily find out the mistake that i am doing.
Thanks.

Quote:
# Set some reasonable defaults for PHP. Most of these cannot be set
# inside the script itself. For hosts that don't have .htaccess
# support but do support per-dir php.ini files, these settings are
# mirrored in php.ini
#
<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>

# Try to disable the parts of mod_security that interfere with the Flash uploader
#
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

# Increase security by uncommenting this block. It keeps browsers
# from seeing support files that they shouldn't have access to. We
# comment this out because Apache2 requires some minor configuration
# in order for you to use it. You must specify "AllowOverride Limit"
# in your Apache2 config file before you uncomment this block or
# you'll get an "Internal Server Error".
#
# <FilesMatch "(\.(class|fla|gitignore|inc|ini|sql|txt)|(README|LICENSE|.build_number))$">
# Order deny,allow
# Deny from all
# </FilesMatch>
# <FilesMatch "robots.txt">
# Order allow,deny
# Allow from all
# </FilesMatch>

# Improve performance by uncommenting this block. It tells the
# browser that your images don't change very often so it won't keep
# asking for them. If you get an error after uncommenting this, make
# sure you specify "AuthConfig Indexes" in your Apache config file.
#
# <IfModule mod_expires.c>
# ExpiresActive On
# # Cache all files for a month after access (A).
# ExpiresDefault A2678400
# # Do not cache dynamically generated pages.
# ExpiresByType text/html A1
# </IfModule>

# You can use the mod_rewrite Apache module to get rid of the
# "index.php" from your Gallery 3 urls. Uncomment the block below
# inside the <IfModule> ... </IfModule> lines and then edit the
# RewriteBase line to match your Gallery 3 URL.
#
# Here are some RewriteBase values:
# Gallery 3 URL RewriteBase line
# ============= ====================
# http://example.com/gallery3 RewriteBase /gallery3
# http://example.com/~bob/photos RewriteBase /~bob/photos
# http://gallery3.example.com/ RewriteBase /
#
# Then just use your Gallery 3 without the index.php in the url.
#
# NOTE: future upgrades of Gallery 3 will overwrite this file! If you
# want these changes to be persistent, talk to your system admin about
# putting this block into your Apache config files.
#
<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
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]

RewriteRule ^(.*)page/([^/\.]+)/?$ $1?page=$2 [L]
RewriteCond %{THE_REQUEST} \?page=([0-9]+).*
RewriteRule (.*) $1/page/%1? [R=301,L]
RewriteRule (.*)/page/1 $1 [R=301,L]
</IfModule>

Please suggest/help. Thanks in advance

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2013-02-06 07:28

This has been reported in the modules thread:
http://galleryproject.org/node/102534?page=1#comment-400687
Hopefully somebody with some Apache rewrite expertise can advise.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Thu, 2013-02-07 17:46

I have also already asked the creator of the SEO Mod http://www.milesjcarter.co.uk/blog/photos-on-the-web/gallery-3-seo-part-perfect-url-scheme/#comment-14648

I tried to correct the problem from both sides, but I cannot resolve the problem neither by changing the pages module nor by editing the rewrite code.

In my opinion this line causes the problem: RewriteRule ^(.*)page/([^/\.]+)/?$ $1?page=$2 [L]

The other possibility would be to change the name of the "pages" to anything else like "blog"

www.xeta.at

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sun, 2013-02-10 15:56

I don't use the pages module, but I looked (briefly) at the link @floridave provided. Looks like it can be solved with a Cond.
Try adding RewriteCond %{THE_REQUEST} !^(.*)?/admin/(.*) after the 2nd line.

If it doesn't work, post the full url of the page being redirected that should NOT be redirected.

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Tue, 2013-02-12 13:39
Quote:
Try adding RewriteCond %{THE_REQUEST} !^(.*)?/admin/(.*) after the 2nd line.

Thanks for this great hint!

I will come back with another answer, but it seems that do the trick. I will do some more testing in the evening.

www.xeta.at

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Tue, 2013-02-12 17:01

I have tested it now and with the additional code everything is working. Thanks again for the help!

I have added the Rewrite Cond after

Quote:
#External Rewrite – fixes pagination#
RewriteCond %{THE_REQUEST} \?page=([0-9]+).*
RewriteRule (.*) $1/page/%1? [R=301,L]
RewriteRule (.*)/page/1$ $1 [R=301,L]

Here is my complete htaccess:

Quote:
# Set some reasonable defaults for PHP. Most of these cannot be set
# inside the script itself. For hosts that don't have .htaccess
# support but do support per-dir php.ini files, these settings are
# mirrored in php.ini
#

AddType 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>

# Try to disable the parts of mod_security that interfere with the Flash uploader
#
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

# Increase security by uncommenting this block. It keeps browsers
# from seeing support files that they shouldn't have access to. We
# comment this out because Apache2 requires some minor configuration
# in order for you to use it. You must specify "AllowOverride Limit"
# in your Apache2 config file before you uncomment this block or
# you'll get an "Internal Server Error".
#
# <FilesMatch "(\.(class|fla|gitignore|inc|ini|sql|txt)|(README|LICENSE|.build_number))$">
# Order deny,allow
# Deny from all
# </FilesMatch>
# <FilesMatch "robots.txt">
# Order allow,deny
# Allow from all
# </FilesMatch>

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

# Improve performance by uncommenting this block. It tells the
# browser that your images don't change very often so it won't keep
# asking for them. If you get an error after uncommenting this, make
# sure you specify "AuthConfig Indexes" in your Apache config file.
#
# <IfModule mod_expires.c>
# ExpiresActive On
# # Cache all files for a month after access (A).
# ExpiresDefault A2678400
# # Do not cache dynamically generated pages.
# ExpiresByType text/html A1
# </IfModule>

# You can use the mod_rewrite Apache module to get rid of the
# "index.php" from your Gallery 3 urls. Uncomment the block below
# inside the <IfModule> ... </IfModule> lines and then edit the
# RewriteBase line to match your Gallery 3 URL.
#
# Here are some RewriteBase values:
# Gallery 3 URL RewriteBase line
# ============= ====================
# http://example.com/gallery3 RewriteBase /gallery3
# http://example.com/~bob/photos RewriteBase /~bob/photos
# http://gallery3.example.com/ RewriteBase /
#
# Then just use your Gallery 3 without the index.php in the url.
#
# NOTE: future upgrades of Gallery 3 will overwrite this file! If you
# want these changes to be persistent, talk to your system admin about
# putting this block into your Apache config files.
#
#Defaults#
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

#External Rewrite – fixes pagination#
RewriteCond %{THE_REQUEST} \?page=([0-9]+).*
RewriteRule (.*) $1/page/%1? [R=301,L]
RewriteRule (.*)/page/1$ $1 [R=301,L]

#Condition for fixing Pages Module#
RewriteCond %{THE_REQUEST} !^(.*)?/admin/(.*)

#Internal Rewrite – fixes pagination#
RewriteRule ^(.*)page/([^/\.]+)/?$ $1?page=$2 [L]

#G3 defaults#
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>

But there is one diffrence to the problem of the threadstarter, my "Pages" were always accessible, but i was not able to edit them.

webcycos problem is that the pages are not accessible from visitors.

www.xeta.at

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Tue, 2013-02-12 21:38
xeta wrote:
webcycos problem is that the pages are not accessible from visitors.

First, glad everything's working for you.

For @webcycos: I'd need more info on the exact error (as it appears in the logs) to figure out what's happening. The only thing that stands out initially is that Gallery's default htaccess section should likely be last:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^(.*)page/([^/\.]+)/?$ $1?page=$2 [L]
RewriteCond %{THE_REQUEST} \?page=([0-9]+).*
RewriteRule (.*) $1/page/%1? [R=301,L]
RewriteRule (.*)/page/1 $1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f #DELETE THIS LINE TOO (it's a duplicate)
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> 

(Also, you'll probably want to add the line I wrote for @xeta above.)

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Wed, 2013-02-13 06:19

@webcycos in addition to tempg advice, i think you have another problem with the order in the htaccess, the following line

Quote:
RewriteRule (.*)/page/1$ $1 [R=301,L]

should be moved to the end of the block furthermore the last version of the code for fixing pagination is:

Quote:
RewriteRule ^(.*)page/([^/\.]+)/?$ $1?page=$2 [L]

Do you also go through the modification of the paginator.html.php?

www.xeta.at

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Sat, 2013-02-16 07:32

@webcyco
By chance I came on where your real problem lies, you must not use blanks in the name of the "Pages"

Symply try "About-Freaky" instead of "About Freaky" and i think it will work....

www.xeta.at

 
hoysted

Joined: 2013-02-23
Posts: 1
Posted: Sat, 2013-02-23 06:34

I tried to correct the problem from both sides, but I cannot resolve the problem neither by changing the pages module nor by editing the rewrite code.

 
snackmaster
snackmaster's picture

Joined: 2005-11-20
Posts: 135
Posted: Sun, 2013-02-24 13:52

The SEO code needs to come before the default rewrite rules that ship with G3 - #G3 defaults# in the example below.

<IfModule mod_rewrite.c>

	#External Rewrite - fixes pagination - http://www.milesjcarter.co.uk/blog/photos-on-the-web/gallery-3-seo-part-perfect-url-scheme/#
	RewriteCond %{THE_REQUEST} \?page=([0-15]+).*
	RewriteRule (.*) $1/page/%1? [R=301,L]
	RewriteRule (.*)/page/1$ $1 [R=301,L]

	#Old Gallery redirects
	RewriteBase /gallery	
	RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.jpg.html
	RewriteRule (.*)\.jpg.html$ /gallery/$1/ [L,R=301]	

	#Internal Rewrite - fixes pagination#
	RewriteRule ^(.*)page/([^/\.]+)/?$ $1?page=$2 [L]

   #G3 defaults# 
   Options +FollowSymLinks
   RewriteEngine On
   RewriteBase /gallery
   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>

---
Gallery - 3.0.5
Theme - WindHack
Site - www.gfisk.com/gallery

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Tue, 2013-02-26 06:45

@hoysted: Have you tried my .htaccess?

www.xeta.at

 
shadlaws

Joined: 2012-03-14
Posts: 183
Posted: Mon, 2013-07-15 14:21

Hi everyone,

I've been working on pagination-related stuff for Gallery 3.1, stumbled across this, and wanted to share a thought...

I'm unconvinced the pagination "fix" as described is a good idea. In fact, I suspect it could actually *harm* SEO.

One of the main principles of SEO is this: drive everything to a canonical URL. This way, the URL's stats aren't diluted, maximizing its search potential. The pagination "fix" does the opposite.

Example - by default, we have links like this:
http://www.example.com/gallery/my_awesome_album
http://www.example.com/gallery/my_awesome_album?page=2
http://www.example.com/gallery/my_awesome_album?page=3
http://www.example.com/gallery/my_awesome_album/sweet_pic

Each of the first three links points to essentially the same content, whereas the fourth is clearly different. While query strings get a bad rep in SEO land, they do have the advantage of making the first three URLs look more-or-less the same, which indicates that they *are* the same content.

Using the pagination "fix", these become:
http://www.example.com/gallery/my_awesome_album/page/1
http://www.example.com/gallery/my_awesome_album/page/2
http://www.example.com/gallery/my_awesome_album/page/3
http://www.example.com/gallery/my_awesome_album/sweet_pic

Each of these four links looks completely distinct, and the stats for "my awesome album" get diluted and fall in search rankings.

Is this a reasonable conclusion? Is there something I'm missing here?

Separate topic: adding extra rel links to strongly reinforce what pagination does/doesn't mean is unequivocally good for SEO. I may add this in soon...

Take care,
Shad

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sun, 2013-07-21 17:58

@shadlaws: It depends on how you use your gallery. I consider each page to be distinct: different photos, different titles, different captions, etc. I don't really allow search engine indexing, but, where I do, the "fix" works well and each page is distinct. The result: if a page shows up in the search results, you land on the page where that photo is (instead of whatever the first page may be). The rel links would work against this, too, no?