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.
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?
$wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue.'/', $wb_page_data);
into $wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue, $wb_page_data);
Websites work faster WITH the trailing URL.
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)
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.
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/ )
The good solution would be to modify the form module (view.php) and modify all 'SCRIPT_NAME' into 'PHP_SELF'.Not a good idea:
QuoteThe good solution would be to modify the form module (view.php) and modify all 'SCRIPT_NAME' into 'PHP_SELF'.Not a good idea:
htmlspecialchars(strip_tags($_SERVER['PHP_SELF']))
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]
WB generates PERFECT SEF-URLs. The only issue is that URLs depend on Menu-Titles.
header('Location: '.WB_URL);
into: header('Location: '.WB_URL.'/pages/my-error.php');
if (!$page_id) $page_id = 11;
where 11 should be replaced with the page_id of your 404 page.since you submitted google_sitemap.php you should renamed it that way to not cause error on GToolsi renamed file google_sitemap_shor turl.php to google_sitemap.php, because google knows it.
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: 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!
www.domain.com/home
redirects towww.domain.com/home/
$wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue.'/', $wb_page_data);
into: $wb_page_data = str_replace($linkstart.$link.$linkend, $newvalue, $wb_page_data);
# 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.http://www.dana-svedova.cz/en/home/?_page=en/home/&lang=EN
(works not with the Rev's > 1532)thanks, you mean really greater than 1532?
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.
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]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} wb/pages
RewriteRule ^wb/pages/(.*).php$ /wb/$1/ [R=301,L]
$wb_page_data = str_replace(WB_URL.PAGES_DIRECTORY, WB_URL, $wb_page_data);
return true;
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !^/pages/
RewriteRule ^(.*)$ /pages/$1 [QSA,L]
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]
# If called directly - redirect to short url version
RewriteCond %{REQUEST_URI} pages
RewriteRule ^pages/(.*).php$ /$1/ [R=301,L]
$wb->preprocess($wb_page_data); //process internal links first (WB283 problem)
if(is_object($wb)) $wb->preprocess($wb_page_data); //process internal links first (WB283 problem)
if(method_exists($wb,'preprocess')) $wb->preprocess($wb_page_data); //process internal links first (WB283 problem)
although the [[shorturl]] still shows on the template at the top.
<?php
// automatically include optional WB module files (frontend.css, frontend.js)
register_frontend_modfiles('css');
// register_frontend_modfiles('jquery');
register_frontend_modfiles('js');
?>
in my own page i use the older version of the short-url-script and it works without problemin the short.php
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?
How can I add a 404 error page as it just redirect back to main urlHave a look in short.php and find lhe line:
define('ERROR_PAGE' , '/'); //Change this to point to your existing 404 page.
Change the '/' with the (short) name of your 404 page.define('ERROR_PAGE' , '/my404page'); //Change this to point to your existing 404 page.
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;
i work on it... ;-)
Droplet says invalid php code :? I'm using WB 2.8.3 latest version with this droplet code
<?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 '';
How do I get it to work with a subdomain please?It should work fine on subdomains.
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.
return '[[shorturl]]';
3. put [[shorturlloader]] in your template (remove [[shorturl]] if it was already there).//: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;
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?
Not Found
The requested URL /short.php was not found on this server.
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ /short.php?_wb=$1 [QSA,L]
should be something like RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ /wbdemo/short.php?_wb=$1 [QSA,L]
RewriteRule ^([\/\sa-zA-Z0-9._-]+)$ short.php?_wb=$1 [QSA,L]
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.
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.