Member:
Markus ⋅
Date: August 21, 2010, 08:43 PM
⋅ Subject: "Re: HowTo: Smart URLs and other SEO configurations"
Here are some further notes on URL rewriting, collected and recycled from e-mail support.
URL rewriting, default module and shorter URL form
By default, "Site" is the default module in iWiccle/WWB. As a module, Site mainly features as a container for all the custom pages you create, while the pages in other modules consist primarily of dynamic content posted by users.
While usually a URL like this — index.php?module=blogs&show=latest_posts — would become /blogs/page/latest_posts, the URL rewriting in our current builds shortens the URL for the defaul module to /page/latest_posts, excluding the module name.This is to place your main content higher in the directory-style URL hierarchy.
URL conversion happens in the main .htaccess file. In this case, the rewrite rule reads as follows:
RewriteRule ^page/([a-z0-9_-]*)$ index.php?show=$1
This rule directs all requests to /page/your_page_name directly to your default module. This directive was missing from the .htaccess file in WWB 1.0.1 build — if you're experiencing error 404 messages with default module pages, add this line in.
If you don't want to use the shorter URL form (/page/pagename instead of /page/site/pagename) for your default module, you can open up class_global.php and head to function smart_urls(), and change line #1341:
$new_url = $vars['module'] != $core['init']['default_module'] ? "{$vars['module']}/page/{$vars['show']}" : "page/{$vars['show']}";
To the following:
$new_url = "{$vars['module']}/page/{$vars['show']}";
This will eliminate the feature and handle the URLs for all modules in the same way. (The shortened URL for default module has been made optional and under configuration for the next WWB build.)
When to turn URL rewriting on and off?
While developing your site, we recommend keeping URL rewriting off. You should only keep it on for live / release candidate sites, if you wish to have extra SEO boost from clean URLs. (The longer URLs are also indexed fine, however.)
The URL rewriter automatically converts all internal links matching the pattern, including those you may paste into your posts or add in through the builder. While developing, it's a good idea to also create internal links using the full URL form, and let the engine handle the rest when it's switched on. (The full URLs are much more informative for debugging and development purposes.)
TinyMCE, URL rewriting and image/link paths
Note that the TinyMCE editor included in the Builder doesn't like rewritten URLs. If you add images or links on a page with builder while accessing it using a /directory/style/url, TinyMCE will break them, as it modifies their source URLs without considering the base_href tag of the page — it assumes all links and images added are relative to this "virtual directory" (which of course doesn't exist).
If you have URL rewriting on and you want to edit links or images on pages, you can switch off URL rewriting temporarily, by starting at your editing with an URL such as this: http://www.wiccle.com/index.php?smart_url=off. This will turn it off for you only, and for your current session only.
The above note only concerns TinyMCE editor — you can use the rest of the builder as usual regardless of URL rewriting state. So far, I haven't found a configuration combo that would make TinyMCE behave properly and consistently in both URL modes.
TinyMCE, folder paths and moving sites
TinyMCE URL modifications need to be considered when moving sites. When an installation is in a folder, all images added with TinyMCE end up with the folder path included in the source URL. For example, adding in:
<img src="images/this.jpg" />
... would be changed by TinyMCE into:
<img src="/wicclefolder/images/this.jpg" />
Then, if you have been developing your site for example at http://localhost/wicclefolder or http://mydomain.com/wicclefolder, and now want to transfer it over to your main site URL, this will obviously lead to broken images.
The easiest way to address this is to just open up the .SQL database backup file you've taken in a code/plain text editor, and run a search/replace to replace all instances of ="/wicclefolder/ with just =" . This will make the paths work, wherever you install it.
Likewise, if you need to transfer or copy the installation your main site to a folder, you will need to replace all instances of ="/ with just =" to clean up the paths — otherwise you'll end up with broken images again. This should also be done to page layouts you may export and import from within WWB/iWiccle, if you're importing them to a different location.