The solution for Short (SEO Friendly) URL's

Ruud

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  ?>.
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

sky writer

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:
Quote4. 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.

hgs

Quote from: 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.



OK i fix it
Thanks
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

Ruud

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.

[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

hgs

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
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

hgs

Getestet mit WB 2.8.3SP4  PHP 5.6.8 MySQL 5.6.24
Alles läuft so wie beschrieben
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

Tango

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/:

1. Download the ShortURL "hack" HERE.
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!

dbs

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.
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.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

Gast

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

Ruud

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
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 :)
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

Gast

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

Ruud

Quote from: dbs on April 24, 2015, 10:31:14 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.
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

dbs

Quote from: 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?

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?
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

noolexy

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:

Ruud

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>
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

noolexy

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:

//: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.

Ruud

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.
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

noolexy

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.

Ruud

Quote from: rjgamer on June 30, 2014, 08:22:12 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:
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.



[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

rjgamer

Is it possible to translate URL's from other droplets to short url's?



jacobi22

#142
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

daydreamer


jacobi22

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

daydreamer

Bakery add to cary and view cart not working unless I remove mod rewrite from htaccess  :?

daydreamer

Now working with this

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

Thanks
Rudd