WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: Ruud on March 26, 2010, 05:30:36 PM

Title: The solution for Short (SEO Friendly) URL's
Post by: Ruud on March 26, 2010, 05:30:36 PM
Despite WebsiteBaker produces url's that are believed to be SEO friendly, a lot of people ask for even more friendly URL's.

I created a set of stand alone files (Not a module/snippet) that will enable url's in WebsiteBaker like www.mysite.tld/about_us instead of www.mysite.tld/pages/about_us.php.

The are 3 parts involved:

1. a .htaccess that detects any parameter not being a directory or file and forward that parameter to a script.
2. a script that will do a lookup for the parameter and find the correct page.
3. a Droplet that will transform any internal link on a page to the "short" form.

More explanation and a download can be found on http://short.dev4me.nl/howto/

Please note this approach might not work for every website! Please test before using it in production websites!!

Please let the community know if this works for you.

Download: http://short.dev4me.nl/download/


Ruud
(edit: corrected links)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Hans>NULL on March 26, 2010, 06:13:34 PM
Hide Extension (.php) (http://www.websitebaker2.org/forum/index.php/topic,15226.msg97813)
Hans>NUL
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: snark on April 18, 2010, 11:52:48 AM
is there a simple way to maintain the levelstructure so that the problem with pages with the same menutitle will not occur..

so that  www.website.com/pages/seofriendlyurl.php

will be

www.website.com/seofriendlyurl

and

so that  www.website.com/pages/subpage/seofriendlyurl.php

will be

www.website.com/subpage/seofriendlyurl



Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on April 18, 2010, 11:10:46 PM
Sorry no, not in the way this "hack" is made.

You could try the other solution that Hans>NUL suggested.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: PurpleEdge on April 19, 2010, 02:29:52 PM
Snoork - have a look at this link...

https://forum.WebsiteBaker.org//index.php/topic,15507.0.html
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: SickBoy75 on May 20, 2010, 12:23:58 PM
I don't really understand the problem...

I also didn't like the www.myweb/pages/home.php, so i remove the /pages in the WB config.... and thats all!!!

and i don't have any problem with menus or any other thing.

I also changed the /bakery (which is a default) to make it more SEO, and post the mod on this forum
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on May 20, 2010, 01:51:12 PM
If you (or a webmaster) ever creates a page called admin or media (or any other WB directory) you will be in trouble.
The /pages (or whatever you name it) is there for a reason.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: chio on May 20, 2010, 05:15:05 PM
Does someone here REALLY think, Google cares about the str_length of URLs?

Non SEF-URLs look like /index.php?bl=12784534&blu=12342kXX&ble=9duz34jsdf&sup=sdf8sdjsdf345()

WB generates PERFECT SEF-URLs. The only issue is that URLs depend on Menu-Titles.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: SickBoy75 on May 20, 2010, 07:05:36 PM
If you (or a webmaster) ever creates a page called admin or media (or any other WB directory) you will be in trouble.
The /pages (or whatever you name it) is there for a reason.


good to know, i'm the only one admin this web, so no problem.

The trouble is that the WB direectory will be deleted, isn't it??

For new instalations i will use a SEO word instead of /pages, for me it's enough
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: snaak on December 13, 2010, 08:25:38 PM
question: there is a problem when submitting form. In the help section this is mentioned only no solution is given. Any idea how to fix this?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on December 13, 2010, 10:14:13 PM
question: there is a problem when submitting form. In the help section this is mentioned only no solution is given. Any idea how to fix this?
I have several sites with forms that work ok, what is your problem?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: snaak on December 15, 2010, 05:06:51 PM
hi,
When I push the submit button I got redirected to http://www.domain.com/pages/?_page=pages.
Is this an error in the .htaccess file? Or do you know a workaround.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on December 15, 2010, 05:11:56 PM
What form are you using? I guess it's not the standard WB form..

Anyway, without looking at the form and/or action url I cannot say why this is happening.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 16, 2011, 04:16:32 PM
A new version (v2.0) is made available for download today.
http://short.allwww.nl/

The links will be rewritten diferently from the first version.
A page like
  http://www.mydomain.com/pages/products/myproduct.php
is now rewritten as
  http://www.mydomain.com/products/myproduct/

The nice extra is, also news posts will be used in this format form now on.

Downloadlink: http://short.allwww.nl/download/
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Stefek on November 16, 2011, 06:31:28 PM
Thank you Ruud.

Do I need a new version of WB and News Module to use it?

Regards,
Stefek
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 16, 2011, 07:07:07 PM
Nope, this will work in any WB (2.7 and up)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Stefek on November 16, 2011, 10:41:34 PM
Thank you!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Bug on November 16, 2011, 10:55:36 PM
Would it be easy to also get rid of the trailing slash?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 16, 2011, 11:07:34 PM
Sure, it was added "on purpose" to simulate WP type of links :-)
It is added in the droplet code. Just remove it and it will work without.

Code: (droplet) [Select]
    $wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue.'/', $wb_page_data);into
Code: [Select]
    $wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue, $wb_page_data);
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: PurpleEdge on November 16, 2011, 11:27:46 PM
Websites work faster WITH the trailing URL.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Bug on November 17, 2011, 07:47:48 AM
Websites work faster WITH the trailing URL.

Any documentation on that matter?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: PurpleEdge on November 17, 2011, 08:08:09 AM
Do a search for "URL trailing slash"

You get a redirect without one, to add the trailing slash.

No idea what effect Ruud's mod has though?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 17, 2011, 10:01:26 AM
You get a redirect without one, to add the trailing slash.
That wil only happen when the server needs to send out a default document (i.e. index.php)
In this case all calls are rerouted to a single script. So no differences in redirect with or without the trailing slash.

This url rewrite is purely cosmetic. It has no advantage on indexing by searchengines.
The standard WebsiteBaker way of serving pages is just as good.
It just is meant to create nicer readable url's.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on November 18, 2011, 05:38:37 PM
hi, i have a problem with standard form in wb2.8.2 Rev1518.
after click submit-button the site will redirected to start-page.
what could be the problem?

dbs
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 18, 2011, 11:10:43 PM
Can you share the link where this is happening? (PM if you do not want to make it public)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 18, 2011, 11:42:44 PM
Can you share the link where this is happening? (PM if you do not want to make it public)
Never mind, I found the problem.

The form module, since WB2.8.2, suddenly uses the $_SERVER['SCRIPT_NAME'] variable as the url to post the data.
The script_name is the script that is used after rewrites. This means it will use the /short.php for posting the data.
Previous versions of the form module were using $_SERVER['PHP_SELF']. That will show the original request before any rewriting.

The good solution would be to modify the form module (view.php) and modify all 'SCRIPT_NAME' into 'PHP_SELF'.

The dirty solution is to modify /short.php and add before line 40  (  require.... ) a line that says:
$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
This will fake the correct value in the SCRIPT_NAME variable..
Note: This could break (or fix as well) other modules that make use of that variable!
 
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on November 18, 2011, 11:49:04 PM
have taked the good solution and it works  :-)

now i see a problem with the news module. "read more" makes nothing.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 19, 2011, 12:04:04 AM
now i see a problem with the news module. "read more" makes nothing.
I must confess I only tested on 2.8.1, there it is working fine  (example www.dev4me.nl/nieuws/ )
I will have a look on a 2.8.2. installation later.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Bug on November 19, 2011, 07:45:04 AM
I guess the next step is a version where /posts will also be rewritten to' nieuws' (or whatever the name of the rootparent is)?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: NorHei on November 19, 2011, 09:31:48 AM
Quote
The good solution would be to modify the form module (view.php) and modify all 'SCRIPT_NAME' into 'PHP_SELF'.
Not a good idea:
http://blog.oncode.info/2008/05/07/php_self-ist-boese-potentielles-cross-site-scripting-xss/

Sorry only german, but the code examples should be understandable.

OK, here are some english articles about the problem:
http://seancoates.com/blogs/xss-woes
http://www.mc2design.com/blog/php_self-safe-alternatives
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on November 19, 2011, 09:45:10 AM
oh my god. i must ruuds "good solution" rechange in my form-module?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 19, 2011, 02:37:16 PM
Quote
The good solution would be to modify the form module (view.php) and modify all 'SCRIPT_NAME' into 'PHP_SELF'.
Not a good idea:

The form module (since WB2.7) sanitises the PHP_SELF variable so it will not be affected.
Code: [Select]
htmlspecialchars(strip_tags($_SERVER['PHP_SELF']))
The better solution would be that the module would generate the current url out of the WB database. Not using any $_SERVER[] method. 
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 19, 2011, 03:21:35 PM
I just put a new version (v2.1) on http://short.allwww.nl

This should fix both reported problems.

For redirected pages (the shortened url's) the SCRIPT_NAME variable is now changed with the value of REQUEST_URI. This was already done for the PHP_SELF variable in previous versions, because it would report the wrong url. REQUEST_URI is believed safe to use.
No modifications to the Form modules are needed by this fix.

The news module in 282 is not using defines anymore, so this is changed in the short.php script and is now working in WB282 as well as previous versions.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on November 19, 2011, 04:48:18 PM
Now all seems to be allright  :-)
Good script, thx ruud.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: NorHei on November 20, 2011, 07:49:46 AM
Good Work !
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Sokhim Sim on November 24, 2011, 10:49:37 AM
Good Job, I have test and use this module. But my question with this plugin why we still have old link work after we change to short URL.

Ex 1: http://www.mywebsite.com/pages/accommodations.php

Ex 2: http://www.mywebsite.com/accommodations/

It work the same link but i want to remove Ex 1. How?

Best Regards,  :-D
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 24, 2011, 11:31:49 AM
Try adding this to your .htaccess

Code: [Select]
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]

It shoud replace /pages/something/more.php into /something/more/

See it in action on: http://short.allwww.nl/pages/howto/mod_rewrite.php )
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Sokhim Sim on November 25, 2011, 09:55:58 AM
Thanks it working fine, now work one link something like /accommodations/happy-view-rooms/.

Happy  :-D
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: iradj on December 06, 2011, 11:40:38 AM
Hi Ruud,

I try on a test server (2.8.1, Rev. 1285) and get "500 Internal Server Error". What am I doing wrong?

BR Iradj
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on December 06, 2011, 12:04:39 PM
If you do not have any other rules in the .htaccess it could be that your server does not allow rewriting url's.
If you have other rules, you will need to experiment what is causing the conflict.

The error 500 is the error where the server says: "I don't know what, but something is wrong".
So it is very hard to tell what is wrong.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: iradj on December 06, 2011, 03:23:29 PM
I think you're right. I've just loaded on the server, the modules "download_gallery_2".
In the directory / media / download_gallery is also a ".htaccess" is created. I could not download files from this directory. After I deleted .htaccess did it again.
If the error is actually on my server?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on December 06, 2011, 03:32:20 PM
The "500 Internal Server Error" says it all.
It is a server error.

What you can or cannot do using .htaccess is depending on the server configuration.
You could try asking your hoster (by sending them the .htaccess file) if there is something in the that is not allowed.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: unawave2 on December 07, 2011, 09:01:13 AM
WB generates PERFECT SEF-URLs. The only issue is that URLs depend on Menu-Titles.

In the German section of this forum I wrote some modifications (http://www.websitebaker2.org/forum/index.php/topic,10661.msg145092.html#msg145092) to bypass this restriction:

(http://www.unawave.de/medien/WebsiteBaker/WB-Seiten-Uebersicht-nachher.png)

(http://www.unawave.de/medien/WebsiteBaker/WB-Seiten-Optionen-nachher.png)

(http://www.unawave.de/medien/WebsiteBaker/WB-Seiten-Uebersicht-Resultat.png)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on December 07, 2011, 09:14:57 AM
thx for hint, havn't see it before.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on January 27, 2012, 01:04:44 PM
Hello,

i use short-url v2.2 together with the module 404-redirect v0.4 (http://www.websitebaker2.org/forum/index.php/topic,21145.0.html (http://www.websitebaker2.org/forum/index.php/topic,21145.0.html)).

It seems the module 404 don't work with short-url (in WB2.8.1 and 2.8.2).
If a page was not found i will kicked to domain.de instead error-page.
Can this confirm somebody?

Have tried to change Location in short.php, but wan't work :
Code: [Select]
header('Location: '.WB_URL);
into: header('Location: '.WB_URL.'/pages/my-error.php');

Some hints are welcome.

dbs
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on January 27, 2012, 01:20:27 PM
Try this.. It worked for me ;-)

Edit /short.php and add - after the call to get_seo_link() on line 32 - the line:
Code: [Select]
if (!$page_id) $page_id = 11;where 11 should be replaced with the page_id of your 404 page.

see http://short.allwww.nl/this/is/a/wrong/link/
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on January 27, 2012, 01:34:25 PM
that works   :-)

must bookmark your post, thx ruud.

the redirected page contains /pages/ in the path, but it is better than redirect to start-page.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Xagone on February 24, 2012, 04:39:51 AM
i've mod google_sitemap.php to work with short_url

and added
RewriteRule ^sitemap.xml$ google_sitemap_shor turl.php

right after
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]


so that domain.com/sitemap.xml works like a charm (and added the line:
sitemap: http://www.mydomain.com/sitemap.xml
to the robot.txt)

By the way, sometimes the htaccess needs
Options +FollowSymLinks
and
RewriteBase /
to work properly

[gelöscht durch Administrator]
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on February 24, 2012, 07:28:58 AM
i have no sitemap.xml.
for google-webmastertools i had submitted the url to google_sitemap.php. google says it is all right.
with your google_sitemap_shor turl.php i do the same?
nothing more is needed if i understand this right.
or i rename to google_sitemap.php.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Xagone on February 24, 2012, 03:23:59 PM
google_sitemap.php is Ok, but every single url is "redirected" in the mind of google

google_sitemap_shor turl.php only provides the shorten url, so no redirections

since you submitted google_sitemap.php you should renamed it that way to not cause error on GTools
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on February 24, 2012, 04:31:07 PM
Quote
since you submitted google_sitemap.php you should renamed it that way to not cause error on GTools
i renamed file google_sitemap_shor turl.php to google_sitemap.php, because google knows it.
nothing to do with .htaccess.
right?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Xagone on February 24, 2012, 04:43:35 PM
nope

Did you indicate your sitemap in the robots.txt?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on February 24, 2012, 04:56:45 PM
my "sitemap" is google_sitemap.php.
no entry in robots.txt for this.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Stefek on March 15, 2012, 01:50:26 AM
Ruud, Love you for this solution. Did I mention it already?
  :-P
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Xagone on May 03, 2012, 06:20:42 PM
Just adding to the 404 solution,

after $page_id = get_seo_link($page);


you add 2 lines:
Code: [Select]
if (!$page_id) $page_id = *PAGE ID OF YOUR 404 PAGE*;
header("HTTP/1.0 404 Not Found");
i've added the header("HTTP/1.0 404 Not Found"); to be shure to send the 404 error header witch google and many other web tools use to check if the page exists. with the first method, witch is fine, the header returned was:
200 OK
but if you do not want this fail page to be refered to/indexed, you need to have
404 Not Found
in your http header
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on May 03, 2012, 10:49:54 PM
Good addition, but please implement it like:
Code: [Select]
if (!$page_id) {
  $page_id = *PAGE ID OF YOUR 404 PAGE*;
  header("HTTP/1.0 404 Not Found");
}
otherwise every page will have the status 404!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Xagone on May 03, 2012, 10:54:04 PM
lol, you are SO right! thanks!

I ALMOST blew up my SEO
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on May 10, 2012, 04:41:55 PM
Hello Ruud, thank you so much for this snippet!

I have a question, is it possible to somehow work in a 301 redirect for URL's without a trailing slash, so as to avoid duplicate content? Like so:

Code: [Select]
www.domain.com/homeredirects to
Code: [Select]
www.domain.com/home/
I'd do it myself but I'm afraid of breaking it. :-D
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on May 10, 2012, 04:54:23 PM
Do you really think Goole would see these two links as duplcate content???

The best solution would be to remove the extra / from the generated links (in the droplet). The extra / has no function, it is pure cosmetic.

change:
Code: (untested) [Select]
$wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue.'/', $wb_page_data);into:
Code: (untested) [Select]
$wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue, $wb_page_data);
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on May 10, 2012, 05:03:13 PM
Well, both are somewhat okay (http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html), but I'm anal about these kinds of things. :D Thank you so much! :)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on June 18, 2012, 12:49:46 PM
How would I get this to work with bakery module please?

Thanks
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on June 18, 2012, 01:00:59 PM
Bakery does not use pages that are listed in the "pages" table.
The droplet will therefore not translate bakery links to a short version.

If you use the latest .htaccess (with redirecting deeplinked /pages/.....php pages to their short variant) you need to add a line to prevent bakery pages to be shortened.
instead of the block:
Code: [Select]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]
use
Code: [Select]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} !pages/bakery/
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]
This way /pages/bakery/ pages will use the original urls.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on June 18, 2012, 01:57:46 PM
Great thanks works fine, would be nice to see it work with other modules in the future  :-)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on August 19, 2012, 08:55:13 PM
I seem to be having problems with my multilanguage site. I've tried clicking around and this happened:

1) I clicked to switch to non-default english.
2) Then I clicked back to default language.
3) Then back to english version - this appeared in the address bar:

Code: [Select]
http://www.dana-svedova.cz/en/home/?_page=en/home/&lang=EN

When I click about in the english version, sometimes the address bar has that gibberish on multiple pages. When I hover over links, the format is the correct one, ie. blabla/en/home/

Does anyone have any idea what could be wrong?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Xagone on August 19, 2012, 10:41:24 PM
I seen this on my multilingual websites too, it's normal because WB try to force a lang var and the htaccess repeat it the first time.

but it should not affect SEO.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on August 20, 2012, 05:03:52 PM
Oh, ok. I thought it was something on my end. :) Thank you, Xagone! :)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on August 21, 2012, 08:56:08 AM
Hello,

is it possible?
I've made a multilingual-site, but use at the moment only one language (de).
My wish is: all pages have url without pages/de/ and the home-page shows only www.domain.de instead www.domain.de/de/home/

Can short-url do this?

dbs
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on August 21, 2012, 10:32:48 AM
You should be able to do that by chaging the droplet and the short.php.

For SEO reasons I would not advice this if you ever want to start using the /de/ in the future.
At that time you will need to rebuild your ranking all over again.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on August 21, 2012, 10:36:08 AM
You're right, it stays like it is. Thx.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on August 24, 2012, 03:25:58 PM
Released a new version (2.3) today that fixes a problem with not translated links in WYSIWYG sections when using WB2.8.3.

See: http://short.allwww.nl/download
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on September 21, 2012, 09:20:54 PM
My pages change from

/pages/about.php

to
/about

but links are still /pages/about.php and not /about
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: nibz on September 21, 2012, 11:17:49 PM
Dit you enclude the short url droplet in your template?!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on September 22, 2012, 12:00:05 AM
No how do I add it in to the template index.php?
Thanks
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on September 22, 2012, 12:07:10 AM
First create the droplet and paste the content of the file "dropletcode.txt" in there.
Name the new droplet something like "shorturl".
Somewhere in the html output of your template index.php (i.e. directly after the </html>) write [[shorturl]]

That should do it.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on September 22, 2012, 12:15:57 AM
Great thanks wasn't aware you needed the droplet as well
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on September 27, 2012, 11:09:27 PM
Hi, in the frontend all works fine with v2.3.
Have tested with WB 2.8.1 and 2.8.3.

But if i call a page from the backend (pages overview or page-settings) i have a 404 (accept start-page).
It is a installation in a subfolder. This subfolder will correctly displayed in the link-target (mouseover) in the backend, but not in the url of the called page.
Can somebody confirm this (if somebody understand me)?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: jacobi22 on September 28, 2012, 01:30:58 AM
Try this -> http://www.websitebaker2.org/forum/index.php/topic,22371.0.html  :wink:
(works not with the Rev's > 1532)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on September 28, 2012, 08:20:54 AM
Quote
(works not with the Rev's > 1532)
thanks, you mean really greater than 1532?
We will have in short time the WB 2.8.4, with Rev greater than 1775.
The solution from Stefek can't be the right way for using "short url".
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on September 28, 2012, 10:19:23 AM
It is a installation in a subfolder. This subfolder will correctly displayed in the link-target (mouseover) in the backend, but not in the url of the called page.

Can you show your .htaccess file?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on September 28, 2012, 10:23:21 AM
should be the original-code. nothing else in htaccess.
Code: [Select]
RewriteEngine On
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]

# Send the request to the short.php for processing
RewriteCond %{REQUEST_URI} !^/(pages|admin|framework|cgi-bin|include|languages|media|account|search|temp|templates/.*)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ short.php?_page=$1 [QSA]
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on September 28, 2012, 02:39:38 PM
The problem must be found in this part

Code: [Select]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]

Try something like (assuming you installed in a /wb/ directory)

Code: [Select]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} wb/pages
RewriteRule ^wb/pages/(.*).php$ /wb/$1/ [R=301,L]
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on September 28, 2012, 02:49:25 PM
Thx Ruud, the 404 is solved.
Also the droplet lastmodifiedpages shows now usable links.  :wink:
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ralleman on October 17, 2012, 04:43:31 PM
Hi Ruud,

what should I change in shorturl V2.3 if I just want to remove the directory (/pages).

So e.g. www.domain.com/pages/file.php
to www.domain.com/file.php

Which changes are needed in htaccess, short.php and dropletcode?

Thanks
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on October 17, 2012, 05:13:43 PM
Try this.. (it was one of my first tries)

Remove the /pages/ only use this for droplet code:

Code: (droplet: nopages) [Select]
$wb_page_data = str_replace(WB_URL.PAGES_DIRECTORY, WB_URL, $wb_page_data);
return true;

and this for .htaccess
Code: (.htaccess) [Select]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !^/pages/
RewriteRule ^(.*)$ /pages/$1 [QSA,L]

the short.php script is not needed anymore for this solution.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ralleman on October 18, 2012, 02:53:26 AM
Hi,
thanks for the reply but unfortunately it does not work.  :-(

I changed the 2 lines in the Dropletcode and that works.

But in htaccess the RewriteRule only link to the original pages directory and the complete URL is shown in the browser.
Is there another way. I do not need the short.php for the new (shorter) URL in the browser?

best regards
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on October 18, 2012, 10:08:52 AM
short.php is not needed for this solution.

Do you have any other lines in your .htaccess?
The RewriteRule should not redirect (show the new url in the browser) but just process the rewritten url.

Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ralleman on October 18, 2012, 02:23:30 PM
Hi Ruud,

I had made the modification of unawave2 for my own url and it works, but I think this have no effect.
See here: http://www.websitebaker2.org/forum/index.php/topic,10661.25.html

I only have that 5 lines in my htaccess that you have wrote.

I tested it again and now I have noticed something unusual and not noticed before:
Only the subdirectories do not work correctly!
In wb i have made an internal 302 redirect for these directories to show in the menu.
Although I do not recognize the problem, because all links in showMenu2 are correctly!

See website: http://test.art-finish.de/    (dropletcode only set in German)

Can you still add a line for me to htaccess to avoid duplicate content. I mean a redirect 301 to only show the URL without /pages directory?

Thank you for your help!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on October 18, 2012, 03:30:44 PM
The problem is that on language changes or menu-link pages WB will do an internal 301 redirect to the full url.

This might do the trick:

Code: [Select]
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteCond %{REQUEST_URI} pages/
RewriteRule ^pages/(.*)$ /$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !^/pages/
RewriteRule ^(.*)$ /pages/$1 [QSA,L]

Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ralleman on October 18, 2012, 05:04:32 PM
Hi Ruud,

yes you did it!  :-) Thank You!

I think additionally with your great ShortUrl, this is a second good way for short Url without showing the pages directory in frontend.
I have not tested with news modules but i think it will work.


Thank You!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Meint on December 13, 2012, 09:56:57 PM
Hi Ruud,

I am experimenting with your solution for shorter URLS. After installing it works fine.

However, I do have one question: When I look at the google_sitemap.php file, it still contains the URL's with 'pages' in the URL's. Do you know how to change that so Google has the sitemap with the rewritten URL's?

Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on December 13, 2012, 10:00:36 PM
Hi, from the 2nd page of this thread ...
http://www.websitebaker2.org/forum/index.php/topic,17725.msg158897.html#msg158897 (http://www.websitebaker2.org/forum/index.php/topic,17725.msg158897.html#msg158897)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Meint on December 13, 2012, 10:20:07 PM
Hi dbs,

Thanks for pointing it out to me!  :-)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Meint on December 19, 2012, 06:18:31 PM
Hi,

I am using topics in combination with the short url solution. However, when I click the "Read more" button I end up at the homepage. The site I am using is a multi language website but I also tested it on a single language website and the same happens there.

I am using the basic .htaccess from short url V2.3

I set up a test website to show you what happens. See http://test.wvmkb-server.nl
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on December 19, 2012, 10:35:28 PM
Short url does not know about the topics module, so shortlinks to those pages are not found by the php script.
To make it work, remove the block from the .htaccess where normal links are rewritten to short links.

Code: (remove this part) [Select]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Meint on December 19, 2012, 10:50:22 PM
Hi Ruud,

Thanks. I removed the block and the topis are accessible via the "Read more" link.

So if I understand it correctly Topics can only work with 'pages' in the URL? Or are there other solutions?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on December 19, 2012, 10:53:13 PM
If I remember correctly, topics had some options in the config files to set a different root path for the posts.
Losing the .php will be more difficult.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Meint on December 19, 2012, 10:55:25 PM
Ok, I am going to further investigate. Thanks so far.  :-)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Meint on December 19, 2012, 11:02:05 PM
Hi Ruud,

I could also use the news module as a blog. The short url does work for that. Do you know how to make it possible to change "post" into the page title?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on December 19, 2012, 11:40:32 PM
This is going a bit too much off topic.
I have sent you a PM.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: nibz on February 14, 2013, 01:30:38 PM
Little notice with using this module: (you can list this at your "Problems" page, though this isn't a really a problem!)

The module will not load pages at the rood called:


And also the children will not be loading!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on March 01, 2013, 04:03:29 PM
I've found that when I'm using the ShortURL ([[ShortURL]] in my template) and want to register, after successful registration I get a blank page. The registration details are sent, the user is in the database. Can it be fixed please? I'd like short URLs of the pages (don't care much about the account folders, etc.) but I also need user registration and blank page is kinda unacceptable. :)

Thank you!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on March 01, 2013, 04:25:12 PM
A blank page is usually pointing to some other error.

I just tested with the current shorturl version 2.3 and it is working fine for me.

Try switching on the error_reporting and see if any error is shown.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on March 01, 2013, 04:28:31 PM
Ok, I will try that. Just wanted to say that I'm using a fresh install, newest ShortURL and when I deleted the [[ShortURL]] from my template, all went smoothly with no blank page.  :|
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on March 01, 2013, 04:35:12 PM
Okay, switched to report all errors and got this:

Fatal error: Call to undefined method wb::preprocess() in /home/www/studynet.cz/modules/droplets/droplets.php(37) : eval()'d code on line 3
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: BlackBird on March 01, 2013, 04:40:59 PM
@Dana: The link in your signature is broken. Missing :
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on March 01, 2013, 04:42:53 PM
Thanks, though this is not the site that's giving me problems.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on March 01, 2013, 04:57:22 PM
In the droplet it shows on line 3:
Code: [Select]
$wb->preprocess($wb_page_data); //process internal links first (WB283 problem)
change that into:
Code: [Select]
if(is_object($wb)) $wb->preprocess($wb_page_data); //process internal links first (WB283 problem)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on March 01, 2013, 05:02:21 PM
Hmm, that doesn't seem to be working.  :| It says the same thing.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on March 01, 2013, 05:09:16 PM
Another option:
Code: [Select]
if(method_exists($wb,'preprocess')) $wb->preprocess($wb_page_data); //process internal links first (WB283 problem)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dana on March 02, 2013, 01:45:04 PM
That seems to have done the trick. :) Thank you so much!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on June 15, 2013, 07:23:25 PM
Is there any plans to add support for other modules such as bakery?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on June 15, 2013, 10:29:35 PM
Yes,

I am currently testing with V3.
It will also work with bakery and topics pages,
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on June 15, 2013, 11:52:56 PM
Great looking forward to V3
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on July 02, 2013, 11:13:26 AM
Any update on V3?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on July 03, 2013, 04:11:59 PM
Just put v3 on http://short.dev4me.nl/download/

Nothing is changed in howto use it for new websites.
If you already are using a previous version the droplet/htaccess/short.php all need to be replaced.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on July 03, 2013, 08:56:27 PM
Great work Rudd think this should be hard coded into WB  :-D
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on August 01, 2013, 09:25:02 AM
Having an issue with bakery. When you get to submit order and submit it takes me back to previous page and not through to fill out address. I can see [[shorturl]] at the top of the page which I then realised shorturl was causing the error.

I removed the short urls and it worked fine so not really sure what the problem is.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on August 01, 2013, 10:39:54 AM
Should be solved in Bakery 1.6.
Your version is?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on August 01, 2013, 12:54:14 PM
I am using the latest bakery version.

The continue url in the form is showing as http://domain.com/pages/bakery.php and not http://domian.com/bakery

If I change {SETTING_CONTINUE_URL} in the form to http://domian.com/bakery it works although the [[shorturl]] still shows on the template at the top.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: jacobi22 on August 01, 2013, 01:11:34 PM
Quote
although the [[shorturl]] still shows on the template at the top.

Droplets need the Code register_frontend_modfiles('js') in the head of your Template-index.php
here a sample, which include frotend.css and frontend.js, but not jquery files
Code: [Select]
<?php
        
// automatically include optional WB module files (frontend.css, frontend.js)
        
register_frontend_modfiles('css');
        
// register_frontend_modfiles('jquery');
        
register_frontend_modfiles('js');
?>
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: jacobi22 on August 01, 2013, 01:16:16 PM
in my own page i use the older version of the short-url-script and it works without problem
in a new local wb 2.8.4 project i test the shorturl 3.0 and i have only 404-Errors
the rewrite works in the links and in the adress line from the browser.
Whats the problem here?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: badknight on August 01, 2013, 01:52:49 PM
in my own page i use the older version of the short-url-script and it works without problem
in a new local wb 2.8.4 project i test the shorturl 3.0 and i have only 404-Errors
the rewrite works in the links and in the adress line from the browser.
Whats the problem here?
in the short.php

you can try to debug the problem:
try to commend out the include /chdir and make a simple echo $fullpag;
now you can see the PATH - is there a Error or is it correct?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on August 21, 2013, 08:44:22 PM
How can I add a 404 error page as it just redirect back to main url
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on August 21, 2013, 10:52:13 PM
How can I add a 404 error page as it just redirect back to main url
Have a look in short.php and find lhe line:
Code: [Select]
define('ERROR_PAGE' , '/'); //Change this to point to your existing 404 page.Change the '/' with the (short) name of your 404 page.

Example:
Code: [Select]
define('ERROR_PAGE' , '/my404page'); //Change this to point to your existing 404 page.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on August 22, 2013, 08:54:51 PM
Thanks Rudd missed that
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on September 24, 2013, 11:30:04 AM
Droplet says invalid php code  :? I'm using WB 2.8.3 latest version with this droplet code

Code: [Select]
global $wb;
$wb->preprocess( $wb_page_data);
$linkstart = WB_URL.PAGES_DIRECTORY;
$linkend = PAGE_EXTENSION;
$nwlinkstart = WB_URL;
$nwlinkend = \'/\';

preg_match_all(\'~\'.$linkstart.\'(.*?)\\\\\'.$linkend.\'~\', $wb_page_data, $links);
foreach ($links[1] as $link) {
    $wb_page_data = str_replace($linkstart.$link.$linkend, $nwlinkstart.$link.$nwlinkend, $wb_page_data);
}
return true;
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: badknight on September 24, 2013, 11:39:51 AM
there are many erros

(e.g "nwlinkend, preg_match_all,..) look at the php - Info  is there magic_quotes_gpc on? (http://php.net/manual/en/security.magicquotes.php)

Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on September 24, 2013, 11:47:59 AM
Thanks badknight,

Yes magic quotes are on on my host, is there a way to fix the short url droplet? I'm no php expert at all  :?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on September 24, 2013, 12:08:16 PM
Is this error with server or caused by WB Revision 1960?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on September 24, 2013, 12:38:41 PM
Magic quotes now off, but droplet still says php errors :?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: DarkViper on September 24, 2013, 12:43:20 PM
i work on it... ;-)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on September 24, 2013, 12:46:54 PM
i work on it... ;-)

Thanks DarkViper :-D
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: DarkViper on September 24, 2013, 06:47:11 PM
Droplet says invalid php code  :? I'm using WB 2.8.3 latest version with this droplet code

First please disengage magic_quotes, because newer code does not care for.

Code: [Select]
<?php // for syntax highlighting only!

$sSearchPattern '/' preg_quote(WB_URL PAGES_DIRECTORY'/') . '(.*?)'
                
preg_quote(PAGE_EXTENSION'/') . '/';
if(
preg_match_all($sSearchPattern$wb_page_data$aMatches))
{
foreach($aMatches[1] as $sLink)
{
$wb_page_data str_replace(WB_URL PAGES_DIRECTORY $sLink PAGE_EXTENSION,
                            WB_URL $sLink '/',
                            $wb_page_data
                           );
}
}
return 
'';


Sorry for delay... 
But today I had to go out and enjoy the afternoon sun.  8-)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: N1kko on September 26, 2013, 09:26:05 PM
Thanks for this, I have added the new droplet code but still getting error and short urls not working  :?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on November 14, 2013, 04:36:24 PM
How do I get it to work with a subdomain please?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on November 14, 2013, 05:02:26 PM
How do I get it to work with a subdomain please?
It should work fine on subdomains.
What is not working in your case?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on November 14, 2013, 06:54:17 PM
Hi Rudd,

I have attached an image to show the error
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on November 14, 2013, 07:54:41 PM
Now working with this

RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ /baker/short.php?_wb=$1 [QSA,L]

Thanks
Rudd
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on February 19, 2014, 03:28:49 PM
Bakery add to cary and view cart not working unless I remove mod rewrite from htaccess  :?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: jacobi22 on February 19, 2014, 03:37:12 PM
you can use the module simplepagehead - it works with bakery

Download here -> http://www.websitebakers.com/pages/modules/various/simple-page-head.php


forget it ...  & sorry
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: daydreamer on February 19, 2014, 05:05:59 PM
I'm using simple pagehead already Thanks  :-D
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: jacobi22 on February 19, 2014, 05:35:34 PM
i read another thread in a second window - my answer was correct, but in the wrong thread  :oops: :wink:

but for your problem.....
i use on my page the old btw first version from the short-url-script
i add a field in the database-table "pages", called seo_url
then i change the seo_tool from Stefek, so that i can change the entry for this field.
for every page i add this seo_link-name in the database
in the frontend i have links like www.myDomain/home - without a file-typ at the end
then i change the ShortUrl-Droplet to read-out this field seo_link (and not link)

forget a little...
you have to change the select in the short.php too

i dont test it in bakery, but it works in news - if you have no seo_link (like news-postings oder bakery-pages, the script use the normal link

maybe, thats a solution for you too
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: rjgamer on June 30, 2014, 08:22:12 AM
Is it possible to translate URL's from other droplets to short url's?


Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on June 30, 2014, 10:08:21 AM
Is it possible to translate URL's from other droplets to short url's?
It is not possible to controll the order of the droplets being executed, so you cannot make sure the shorturl droplet is executed last. That is the reason why some droplet-generated-links will be translated and some not.

The trick is:

Create a droplet that just generates your shorturl droplet as output.
The droplet engine (in WB 2.8.3) will process all found droplets. When it's finished it will check again if new droplets are found.
So, steps to follow:

1. create the normal [[shorturl]] droplet first.
2. create a droplet called [[shorturlloader]] with the content:
Code: [Select]
return '[[shorturl]]';3. put [[shorturlloader]] in your template (remove [[shorturl]] if it was already there).

That does it for me.

Note that the "other droplets" will need to output full url's (including the domain), otherwise they will not be detected as internals.



Title: Re: The solution for Short (SEO Friendly) URL's
Post by: noolexy on August 20, 2014, 04:09:17 AM
Hi,

I have the latest version of Bakery 1.7.0 and the latest version of WebsiteBaker Shorturls Version 3.0. Everything works fine until the user clicks the submit button to check out after adding the product to their cart. It doesn't allow them to put their address, but simply takes them back to the store (Bakery). Any suggestions? Thank you.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on August 20, 2014, 10:45:39 AM
Looking at the site you sent by mail, it seems to me you are not including the shorturl droplet in your template.

Not related to this prblem, your website has javascript (and CSS loading) errors that will make Bakery not function correctly.
An extra tip: Your homepage is loading about 16Mb on images, making the time to load for me something like 20 seconds.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: noolexy on August 20, 2014, 06:26:55 PM
Hi Ruud,

Thanks for getting back to me  :-)

I will resize my images. I think I fixed the css and js problems.

When I add the droplet to my template, it comes back blank.

This is what I am using:

Code: [Select]
//:create short url's
//:
//Shorturl - remove pages/php from links
global $wb;
$wb->preprocess($wb_page_data);
$linkstart = WB_URL.PAGES_DIRECTORY;
$linkend = PAGE_EXTENSION;
$nwlinkstart = WB_URL;
$nwlinkend = '/';

preg_match_all('~'.$linkstart.'(.*?)\\'.$linkend.'~', $wb_page_data, $links);
foreach ($links[1] as $link) {
    $wb_page_data = str_replace($linkstart.$link.$linkend, $nwlinkstart.$link.$nwlinkend, $wb_page_data);
}
return true;

Thanks for your help.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on August 20, 2014, 11:00:56 PM
Without the droplet shorturl will not function!
Try switching on the error reporting (advanced settings page) and see if an error is shown.

Note that the droplet should be somewhere in the HTML part of the template.
For example just after the </html>
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: noolexy on August 21, 2014, 01:52:08 AM
Thank you! It worked.

I was putting it in the php coding part, I guess that's why it didn't work. Thank you again for your assistance  :wink:
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on April 24, 2015, 10:31:14 AM
in my own page i use the older version of the short-url-script and it works without problem
in a new local wb 2.8.4 project i test the shorturl 3.0 and i have only 404-Errors
the rewrite works in the links and in the adress line from the browser.
Whats the problem here?

Normally i deactiviate the .htaccess on local systems. It's easier as comment out some things like rewrite non-www to www.
This is the reason why i never tested shorturl local.
Today, in a test with shorturl3 and wb283 i can see only (except startpage and searchpage):
Not Found
The requested URL /short.php was not found on this server.
Apache/2.4.10 (Win32) OpenSSL/1.0.1h PHP/5.4.31 Server at localhost Port 4001


What can be the reason?
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on April 24, 2015, 10:52:43 AM
Not Found
The requested URL /short.php was not found on this server.

Did you install WB in a subdirectory? The htaccess assumes short.php to be in the webspace root.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Gast on April 24, 2015, 10:55:59 AM
looks for me, that vers 3.0 starts the rewrite in the document root of the server, but i use a subfolder of this document root
example: one of my local virtual servers = cms
subfolder for the test-wb = wbdemo
rewrite goes to cms, not to cms/WB_URL or WB_URL (like version1)

but i dont have a short.php in cms
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on April 24, 2015, 11:03:57 AM
The whole point of using shorturl is that url's are not having any unneeded url-segments.
So it makes no sense to remove the /pages/ but add a /wbdemo/.

To make it work you will need to rewrite the rules in the htaccess to allow a subdirectory.
At least this line
Code: [Select]
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ /short.php?_wb=$1 [QSA,L]should be something like
Code: (utested) [Select]
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ /wbdemo/short.php?_wb=$1 [QSA,L]
I am not sure if you need more changes though, I never tried that :)
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Gast on April 24, 2015, 11:31:03 AM
i'm not the mod_rewrite-expert, but in my doku they use RewriteBase for the Start-Folder
No RewriteBase-info or a RewriteBase like a simple slash like / means: start in the document-root of this server

a rewrite rule like this
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ /short.php?_wb=$1 [QSA,L]
means also: start in the document root

a rewrite rule without leading slash means: start in the same folder like the htaccess btw the index.php in the root of wb
Everything works fine, if i dont use the leading shlash, with or without RewriteBase

please correct me, if i'm wrong
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: dbs on April 24, 2015, 12:48:13 PM
Yes, my  local installation use a subfolder (the confg.php knows it).
After removing the slash before short.php in
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ /short.php?_wb=$1 [QSA,L]
it works for me local.
Code: [Select]
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ short.php?_wb=$1 [QSA,L]
Thx to jacobi22

It was not the WBPortable, but i will try it there also.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Tango on June 10, 2015, 09:26:23 PM
Hello,

Tested this locally on PHP 5.4.40, Apache 2.4.12, MySQL 5.5.42 and WB 2.8.3 SP4 with BAKERY and some other modules installed and it works fine.

I also made a short how to install, which I think its clearer than the on posted on http://short.dev4me.nl/ (http://short.dev4me.nl/):

1. Download the ShortURL "hack" HERE (http://short.dev4me.nl/download/).
2. Upload short.php and .htaccess to your website root directory (where config.php is located).
3. Create a Droplet using the code found in droplets.txt (you can name it ShortURL).
4. Add the newly created Droplet to the HTML part of your Template (for example, just after the </html>).


Thank you for your amazing work Ruud, you are a legend!
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: hgs on June 11, 2015, 09:02:41 AM
Getestet mit WB 2.8.3SP4  PHP 5.6.8 MySQL 5.6.24
Alles läuft so wie beschrieben
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: hgs on June 12, 2015, 10:02:57 AM
Ich bin verwirrt.
Habe die 2 Dateien (short.php; .htaccess) ins jeweilige root der WB-Instanz kopiert und das Droplet ShortURL erzeugt.
Bei der 1. WB-Instanz habe ich das Droplet im Template eingefügt und wie oben beschrieben getestet.
Bei den anderen WB-Instanzen wurde das Droplet nicht ins Templet eingefügt und es funktioniert genauso.
Ist das normal?
WB 2.8.3 SP3 + SP4, PHP 5.5x und 5.6x

Googletranslate
I'm confused.
Have the 2 files (short.php; .htaccess) copied to the root of the respective WB instance and the Droplet ShortURL generated.
In the 1st WB instance I have inserted the Droplet in the template and tested as described above.
In the other instances, the WB Droplet was not inserted in the template and it works the same way.
Is that normal?
WB 2.8.3 SP3 + SP4, PHP 5.5x and 5.6x
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on June 12, 2015, 10:26:54 AM
The htaccess will rewrite an incoming request for something like /pages/home.php to /home/ .

Hover the links in the menu to see that without the droplet they will link to /pages/***.php.
The rewrite is done so the browser addressbar will show the short version.

There are two problems..
1. Google will index your pages as /pages/***.php
2. Every call needs a rewrite, causing your browser to make another call. This is making the connection to your website slower.

Title: Re: The solution for Short (SEO Friendly) URL's
Post by: hgs on June 12, 2015, 01:53:32 PM
The htaccess will rewrite an incoming request for something like /pages/home.php to /home/ .

Hover the links in the menu to see that without the droplet they will link to /pages/***.php.
The rewrite is done so the browser addressbar will show the short version.

There are two problems..
1. Google will index your pages as /pages/***.php
2. Every call needs a rewrite, causing your browser to make another call. This is making the connection to your website slower.



OK i fix it
Thanks
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: sky writer on July 10, 2015, 07:23:47 AM
I've been using ver 3 on 2.8.3 SP3 and all seems to be working, so I am not trying to break it... but I am confused by these instructions:
Quote
4. Add the newly created Droplet to the HTML part of your Template (for example, just after the </html>).
If you are supposed to add the droplet to the HTML part of your Template, would you not put it BEFORE the </html> ?  Or maybe I do not understand.
Title: Re: The solution for Short (SEO Friendly) URL's
Post by: Ruud on July 10, 2015, 10:21:57 AM
With the "HTML" part is actually meant: not in "PHP" code.
For this droplet it does not matter where you put it, as long as it is not within <?php  ?>.