The solution for Short (SEO Friendly) URL's

Ruud

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:
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]

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

daydreamer

How would I get this to work with bakery module please?

Thanks

dana

Well, both are somewhat okay, but I'm anal about these kinds of things. :D Thank you so much! :)
[url=http://www.dana-svedova.cz]Webdesign by Dana[/url]

Ruud

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

dana

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:

www.domain.com/home
redirects to
www.domain.com/home/

I'd do it myself but I'm afraid of breaking it. :-D
[url=http://www.dana-svedova.cz]Webdesign by Dana[/url]

Xagone

lol, you are SO right! thanks!

I ALMOST blew up my SEO
Xagone Inc. (formerly VotreEspace)
[url="http://xagone.com/"]http://xagone.com/[/url]

Ruud

Good addition, but please implement it like:
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!
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

Xagone

Just adding to the 404 solution,

after $page_id = get_seo_link($page);


you add 2 lines:
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
Xagone Inc. (formerly VotreEspace)
[url="http://xagone.com/"]http://xagone.com/[/url]

Stefek

Ruud, Love you for this solution. Did I mention it already?
  :-P
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

dbs

my "sitemap" is google_sitemap.php.
no entry in robots.txt for this.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

Xagone

nope

Did you indicate your sitemap in the robots.txt?
Xagone Inc. (formerly VotreEspace)
[url="http://xagone.com/"]http://xagone.com/[/url]

dbs

Quotesince you submitted google_sitemap.php you should renamed it that way to not cause error on GTools
i renamed file google_sitemap_shorturl.php to google_sitemap.php, because google knows it.
nothing to do with .htaccess.
right?
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

Xagone

google_sitemap.php is Ok, but every single url is "redirected" in the mind of google

google_sitemap_shorturl.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
Xagone Inc. (formerly VotreEspace)
[url="http://xagone.com/"]http://xagone.com/[/url]

dbs

#49
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_shorturl.php i do the same?
nothing more is needed if i understand this right.
or i rename to google_sitemap.php.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

Xagone

i've mod google_sitemap.php to work with short_url

and added
RewriteRule ^sitemap.xml$ google_sitemap_shorturl.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]
Xagone Inc. (formerly VotreEspace)
[url="http://xagone.com/"]http://xagone.com/[/url]

dbs

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

Ruud

Try this.. It worked for me ;-)

Edit /short.php and add - after the call to get_seo_link() on line 32 - the line:
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/
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

dbs

#45
Hello,

i use short-url v2.2 together with the module 404-redirect v0.4 (https://forum.WebsiteBaker.org/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 :
header('Location: '.WB_URL);
into: header('Location: '.WB_URL.'/pages/my-error.php');


Some hints are welcome.

dbs
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

dbs

[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

unawave2

Quote from: chio on May 20, 2010, 05:15:05 PM
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 to bypass this restriction:






Ruud

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

iradj

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?

Ruud

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

iradj

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

Sokhim Sim

Thanks it working fine, now work one link something like /accommodations/happy-view-rooms/.

Happy  :-D
Freelance Website Design in Cambodia.

Clients: [url="http://www.websitebaker2.org/forum/index.php/topic,24514.0.html"]http://www.websitebaker2.org/forum/index.php/topic,24514.0.html[/url]