xoops forums

reynaldo

Not too shy to talk
Posted on: 2004/2/14 0:38
reynaldo
reynaldo (Show more)
Not too shy to talk
Posts: 106
Since: 2004/2/13
#1

ShortURLs hack

This is a hack I'm using on my sites to convert XOOPS urls into shorter
urls which can be indexed by Search Engines.

I've found other hacks that do the same but I didn't like the way the worked
because I haven't had good results with urls within deep directorys like:

http://www.domain.com/modules/news/article/1/arg1/arg2

In my experience, some Search Engines (Google for example) didn't like
to crawl pages so "deep" within the site.

This hack uses simpler and shorter urls, for example, instead of

http://www.domain.com/modules/news/article.php?storyid=1279
or
http://www.domain.com/modules/news/article/storyid/1279
you could have:
http://www.domain.com/article1279.html

Right now it shortens urls for the following modules:
News
Userinfo
Submit
Archive
Sections
Xoopspartners

I think those are the more important parts from a XOOPS powered site.
It has been tested on my sites which are being powered by XOOPS 2.06, it
*should* work with other versions too.

You can download it from:
http://www.wtmmail.com/XoopsShortUrls/ShortURLs_0.1_for_Xoops.zip

How to install it?
------------------
Installation is simple:

1) Upload this two files to your XOOPS root dir:
- loadpage.php
- xoops_shorturls.php
2) Modify your .htaccess file, the one you have in your XOOPS root dir (if any)
and add the contents of the included .htaccess file. If you don't have one, just upload the one I provided.

3) In the XOOPS root dir, there is a file named mainfile.php
Open it and add the following line just after the disclaimer (line 27 for
Xoops 2.06):

include "xoops_shorturls.php";

Save mainfile.php and upload it to your server.

IMPORTANT! IMPORTANT! IMPORTANT! IMPORTANT! IMPORTANT!
You have to edit the mainfile.php that is in your server, not the one that
originally comes with you Xoops, as this file is changed after installation.


After this, open your site. You should have ShorUrls for some of the modules.
I'll be adding support for other modules as I see fit. Please report any errors
or difficulties you may have to this post.

Stewdio

Community Support Member
Posted on: 2004/2/14 2:32
Stewdio
Stewdio (Show more)
Community Support Member
Posts: 1560
Since: 2003/5/7 1
#2

Re: ShortURLs hack

Bookmarked this post for prosperity (too lazy to update)

Nicely done.

shivaji

Friend of XOOPS
Posted on: 2004/2/14 5:48
shivaji
shivaji (Show more)
Friend of XOOPS
Posts: 179
Since: 2003/9/18
#3

Re: ShortURLs hack

Hi:

Thanks a lot, I came to know about this thread from sunrapper! I am still running my site on 2.05 :(. I will keep you posted soon i upgrade my site to 2.06.

Thanks again for the excellent information regarding short URL.

catalin

Just popping in
Posted on: 2004/2/14 7:02
catalin
catalin (Show more)
Just popping in
Posts: 30
Since: 2003/9/4 7
#4

Re: ShortURLs hack

reynaldo ... i am using XOOPS 2.0.3 and the thing with loadpage and xoopsshort.urls works, loads the frontpage but it seems that when i click on the article it loads an error page and in the addres bar it says

/article487.html ( for ex ) but the page does not load, it gives me a NOT FOUND

have any fix for this

i would be in depht if you would help me

the site is www.cyber-cup.ro ( the short url is deactivated )

carnuke

Home away from home
Posted on: 2004/2/14 7:58
carnuke
carnuke (Show more)
Home away from home
Posts: 1955
Since: 2003/11/5
#5

Re: ShortURLs hack

Hi reynaldo

I noticed that this is your first post, so welcome to the forums This is an awsome first post!

I just want to say thatnk-you for sharing this important addition to the XOOPS system. I have not yet installed or tried this hack, but it looks very useable. Ultimately it would be required module wide, or at least the major modules as you have already done. I would personally like to see it working for WFsectins as most of my site is built around this. Maybe you can do this in time?

Thanks again Richard

reynaldo

Not too shy to talk
Posted on: 2004/2/14 13:04
reynaldo
reynaldo (Show more)
Not too shy to talk
Posts: 106
Since: 2004/2/13
#6

Re: ShortURLs hack

Catalin:

Just to be clear, for this hack to work, it requires Apache to be compiled with the RewriteEngine module.

If this is not your case, check to make sure you uploaded/appended the .htaccess file I included.

I can help you to get the hack working, just let me know the next time you try

reynaldo

Not too shy to talk
Posted on: 2004/2/14 13:08
reynaldo
reynaldo (Show more)
Not too shy to talk
Posts: 106
Since: 2004/2/13
#7

Re: ShortURLs hack

Quote:

carnuke wrote:
Hi reynaldo

I noticed that this is your first post, so welcome to the forums This is an awsome first post!


Thanks!

Quote:

I just want to say thatnk-you for sharing this important addition to the XOOPS system.


I just found XOOPS four days ago and I really like the way it works, lightning fast and it is so intuitive. I'm not using it as much as I would like because I would need a multisites CMS

Quote:

I have not yet installed or tried this hack, but it looks very useable. Ultimately it would be required module wide, or at least the major modules as you have already done. I would personally like to see it working for WFsectins as most of my site is built around this. Maybe you can do this in time?


I'll try as soon as I have a few minutes available

Quote:

Thanks again Richard

You're welcome!

reynaldo

Not too shy to talk
Posted on: 2004/2/14 13:10
reynaldo
reynaldo (Show more)
Not too shy to talk
Posts: 106
Since: 2004/2/13
#8

Re: ShortURLs hack

Quote:

shivaji wrote:
Hi:

Thanks a lot, I came to know about this thread from sunrapper! I am still running my site on 2.05 :(. I will keep you posted soon i upgrade my site to 2.06.


Shivaji, I didn't say it requires 2.06 to work, I said I tested it on 2.06, and I don't think 2.05 would be too different to 2.06, so maybe you can test it without upgrading.

tms_hide

Just popping in
Posted on: 2004/2/14 13:34
tms_hide
tms_hide (Show more)
Just popping in
Posts: 1
Since: 2004/2/14
#9

Re: ShortURLs hack

>>catalin
I was in just same situation.
But, when I turned on "RewriteEngine" and altered .htancess
,I could resolove NOT FOUND error.
This .htancess script is I altered..
# -FrontPage-
[b][color=FF0000]RewriteEngine on [/color][/b]

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

RewriteRule ^topic([0-9]+).htmlloadpage.php [L]

RewriteRule ^article([0-9]+).htmlloadpage.php [L]

RewriteRule ^articles.htmlloadpage.php [L]

RewriteRule ^user([0-9]+).htmlloadpage.php [L]

RewriteRule ^submit.htmlloadpage.php [L]

RewriteRule ^archive.htmlloadpage.php [L]

RewriteRule ^sections.htmlloadpage.php [L]

RewriteRule ^partners.htmlloadpage.php [L]

RewriteRule ^$ loadpage.php [L]

reynaldo

Not too shy to talk
Posted on: 2004/2/14 14:02
reynaldo
reynaldo (Show more)
Not too shy to talk
Posts: 106
Since: 2004/2/13
#10

Re: ShortURLs hack

tms_hide:

You are right!
I forgot to include the RewriteEngine on line
I uploaded a corrected version to my server.