xoops forums

DonCurioso

Quite a regular
Posted on: 2009/7/16 0:50
DonCurioso
DonCurioso (Show more)
Quite a regular
Posts: 239
Since: 2009/3/1 1
#1

Canonical URI´s over Xoops

Hi,

we believe with Celseven, our programming partners than we will found a solution to have canonical URL under Xoops.

Create a file. Htaccess with the following code:
Options FollowSymlinks
RewriteEngine on
RewriteCond 
%{ HTTP_HOST }^hispaxoops.com NC ]
RewriteRule ^(.*)$ http://www.hispaxoops.com/$1 [L,R=301]


Change this domain for yours, save and upload to your XOOPS folder.

Edit header php, around line 69 and include these lines:

//www.celseven.com - Definir URL Canónica - XOOPS
echo "<link rel='canonical' href='".XOOPS_URL.$_SERVER['REQUEST_URI']."'/>" ;
//www.celseven.com - URL Canónica definida


Save&upload.
That´s all !!! It´s working for us... what about you ?

All info here.


Suggestions, comments... all welcome !!!
HispaXoops | Xoops España

That's the way i like it! | Nada mejor que una Alhambra bien helada con aceitunas...

bjuti

Just can't stay away
Posted on: 2009/7/17 9:35
bjuti
bjuti (Show more)
Just can't stay away
Posts: 871
Since: 2009/1/7 2
#2

Re: Canonical URI´s over Xoops

Does not work for me... I got "Internal Server error"...

pw-kw

Just popping in
Posted on: 2009/7/17 9:54
pw-kw
pw-kw (Show more)
Just popping in
Posts: 50
Since: 2007/2/1 8
#3

Re: Canonical URI´s over Xoops

test this ... for me ... it works fine:

RewriteEngine On 
RewriteCond 
%{HTTP_HOST}   !^www.your-domain.com [NC
RewriteCond %{HTTP_HOST}   !^$ 
RewriteRule ^(.*)$ http://www.your-domain.com/$1 [L,R=301]

anderssk

Quite a regular
Posted on: 2009/7/17 10:35
anderssk
anderssk (Show more)
Quite a regular
Posts: 335
Since: 2006/3/21
#4

Re: Canonical URI´s over Xoops

Try post without code-tags - please.
The code-tags mess things up

bjuti

Just can't stay away
Posted on: 2009/7/17 13:40
bjuti
bjuti (Show more)
Just can't stay away
Posts: 871
Since: 2009/1/7 2
#5

Re: Canonical URI´s over Xoops

when i do:

RewriteCond %{HTTP_HOST}   !^www.your-domain.com [NC]  RewriteCond %{HTTP_HOST}   !^$  RewriteRule ^(.*)$ http://www.your-domain.com/$1 [L,R=301]


it works, but i can't go to the other pages in news which is landing module, using the navigation 1, 2, 3.. page...

when i say that it works, i mean that i don't get a server error, but cannonical dosen't work.. stil is www.mysite.com/index.php

maybe coz i have url rewrite smarty module turned on..

DonCurioso

Quite a regular
Posted on: 2009/7/18 0:36
DonCurioso
DonCurioso (Show more)
Quite a regular
Posts: 239
Since: 2009/3/1 1
#6

Re: Canonical URI´s over Xoops

Hi everybody,

many servers couldn't accept Options + FollowSymlinks, i don't all reasons, of curse. If you get an error 500 or blank page, try without this.

bjuti,

we have rewrite turned on too & doesn't matter, all it´s ok.

pw-kw & bjuti,

read again your codes, they're wrong.

First rule after Rewrite Engine On defines if you want your domain with or without www, please, check it. I feel you´ve error there.

Copy&paste my code, remove some spaces, wirte there your domain & it works!

Regards.
HispaXoops | Xoops España

That's the way i like it! | Nada mejor que una Alhambra bien helada con aceitunas...

bjuti

Just can't stay away
Posted on: 2009/7/18 10:24
bjuti
bjuti (Show more)
Just can't stay away
Posts: 871
Since: 2009/1/7 2
#7

Re: Canonical URI´s over Xoops

This is my .htaccess

Quote:
Options + FollowSymLinks
RewriteEngine On

RewriteCond %{ HTTP_HOST }^mysite.com [ NC ]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]
RewriteRule ^vesti/(.*) /modules/news/$1 [QSA,L]
RewriteRule ^tekstovi/(.*) /modules/smartsection/$1 [QSA,L]
RewriteRule ^tekstovi\.([a-z]+)\.([0-9.]+)/ modules/smartsection/seo.php?seoOp=$1&seoArg=$2
RewriteRule ^download/(.*) /modules/wfdownloads/$1 [QSA,L]
RewriteRule ^rss/(.*) /modules/rss/$1 [QSA,L]
RewriteRule ^mapa-sajta/(.*) /modules/sitemap/$1 [QSA,L]
RewriteRule ^kontakt/(.*) /modules/liaise/$1 [QSA,L]
RewriteRule ^casopis/(.*) /modules/mastop_publish/$1 [QSA,L]
RewriteRule ^blog/(.*) /modules/planet/$1 [QSA,L]
RewriteRule ^tekstovi-glavna/(.*) /modules/tekstovinovo/$1 [QSA,L]

ErrorDocument 404 /404.html


And it still does not work. :) What I'm doing wrong?

It doesn't work with this also:

Quote:
Options +FollowSymLinks


When I put just:
Quote:
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]


I got:

Quote:
The page isn't redirecting properly


Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

* This problem can sometimes be caused by disabling or refusing to accept cookies.

DonCurioso

Quite a regular
Posted on: 2009/7/18 14:31
DonCurioso
DonCurioso (Show more)
Quite a regular
Posts: 239
Since: 2009/3/1 1
#8

Re: Canonical URI´s over Xoops

Hi,

i´ll try on plain text

---------------------------------------------------------------
RewriteEngine On

RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]
RewriteRule ^vesti/(.*) /modules/news/$1 [QSA,L]
RewriteRule ^tekstovi/(.*) /modules/smartsection/$1 [QSA,L]
RewriteRule ^tekstovi\.([a-z]+)\.([0-9.]+)/ modules/smartsection/seo.php?seoOp=$1&seoArg=$2
RewriteRule ^download/(.*) /modules/wfdownloads/$1 [QSA,L]
RewriteRule ^rss/(.*) /modules/rss/$1 [QSA,L]
RewriteRule ^mapa-sajta/(.*) /modules/sitemap/$1 [QSA,L]
RewriteRule ^kontakt/(.*) /modules/liaise/$1 [QSA,L]
RewriteRule ^casopis/(.*) /modules/mastop_publish/$1 [QSA,L]
RewriteRule ^blog/(.*) /modules/planet/$1 [QSA,L]
RewriteRule ^tekstovi-glavna/(.*) /modules/tekstovinovo/$1 [QSA,L]

ErrorDocument 404 /404.html

---------------------------------------------------------------

Replace mysite & it must works !!!
HispaXoops | Xoops España

That's the way i like it! | Nada mejor que una Alhambra bien helada con aceitunas...

bjuti

Just can't stay away
Posted on: 2009/7/18 22:07
bjuti
bjuti (Show more)
Just can't stay away
Posts: 871
Since: 2009/1/7 2
#9

Re: Canonical URI´s over Xoops

Tnx, it works now! :)

Now tell me.. is it possible to redirect www.mysite.com/index.php to only www.mysite.com? I've tired once, but navigation in news module didn't work..

Tnx again

DonCurioso

Quite a regular
Posted on: 2009/7/19 1:50
DonCurioso
DonCurioso (Show more)
Quite a regular
Posts: 239
Since: 2009/3/1 1
#10

Re: Canonical URI´s over Xoops

bjuti,

add to your .htaccess:

redirect 301 /index.php http://www.yoursite.xyz

I think that's all... simply but effective


I feel it´s not possible because many modules have got an index.php

Maybe i´m on an error... maybe not.

Have luck !
HispaXoops | Xoops España

That's the way i like it! | Nada mejor que una Alhambra bien helada con aceitunas...