re: PLEASE give me CLEAN URLS!
Moderator: Tata
re: PLEASE give me CLEAN URLS!
hi, im not sure if addons and plugins is the right area but i am hoping there is someone out there who can help.
there is a very outdated guide on using clean URLs for cmsimple ( removing the " ? '' query string from urls ) on the wiki - http://www.cmsimplewiki.com/doku.php/ti ... /clean_url
it would be really appreciated if the community could look at updating this guide to work with cmsimple xh, whether its a plugin or wiki update - anything would be good!
if a flat file cms like get simple can do it then cmsimple can - http://get-simple.info/start/cms-comparisons/
there is a very outdated guide on using clean URLs for cmsimple ( removing the " ? '' query string from urls ) on the wiki - http://www.cmsimplewiki.com/doku.php/ti ... /clean_url
it would be really appreciated if the community could look at updating this guide to work with cmsimple xh, whether its a plugin or wiki update - anything would be good!
if a flat file cms like get simple can do it then cmsimple can - http://get-simple.info/start/cms-comparisons/
Re: re: PLEASE give me CLEAN URLS!
Hi kweku,
I don't really understand, why everybody is still so hipped about the so-called "clean urls". I doubt that it makes a difference for users. Most users have no understanding of the structure of URLs, so in the rare case they have to enter a URL directly in the browser's address line, they will do it with or without the "?". The few who do understand the structure of URLs, might have some trouble to remember to put in the "?" in, but I guess, they'll get it on the second try. So what remains is SEO. But if I'm not mistaken, modern search engines have absolutely no trouble with query parameters. In fact they treat different query parameters as different URLs, so what's much more important for SEO, is to tell the search bots which query parameters to ignore. E.g. the SE will treat http://www.example.com/ and http://www.example.com/?&print as different pages, resulting in DC. The ge_canonical plugin caters for several cases, but IMO regarding several plugins a more general and tunable solution is needed.
Having said this, I'm not against the clean URLs. But there are several problems:
Christoph
I don't really understand, why everybody is still so hipped about the so-called "clean urls". I doubt that it makes a difference for users. Most users have no understanding of the structure of URLs, so in the rare case they have to enter a URL directly in the browser's address line, they will do it with or without the "?". The few who do understand the structure of URLs, might have some trouble to remember to put in the "?" in, but I guess, they'll get it on the second try. So what remains is SEO. But if I'm not mistaken, modern search engines have absolutely no trouble with query parameters. In fact they treat different query parameters as different URLs, so what's much more important for SEO, is to tell the search bots which query parameters to ignore. E.g. the SE will treat http://www.example.com/ and http://www.example.com/?&print as different pages, resulting in DC. The ge_canonical plugin caters for several cases, but IMO regarding several plugins a more general and tunable solution is needed.
Having said this, I'm not against the clean URLs. But there are several problems:
- clean URLs require some URL rewriting mechanism (e.g. mod_rewrite for Apache), but this is not offered consistently by all hosting companies (not all use Apache). This is probably the reason, why CMSimple never made clean URLs the default: it's meant to run "everywhere" (AFAIK GetSimple on the contrary requires PHP 5.2 and an Apache server).
- to use the URL rewriting, one has to specify some rules. So if a request to http://www.example.com/start is made, this should be rewritten to be http://www.example.com/?start. But wait: what if there is a folder named start/, that should be accessed by the given URL? This has to be specified as exception in the URL rewrite rules. But if the exception is specified, no page may be called "start" any more. (in practise this might be a minor problem, but it has to be considered nonetheless).
- to present the clean URLs in the first place, the core of CMSimple has to be adapted in several places, and all plugins have to be adapted too. This wouldn't be necessary, if all plugin where using a() instead of constructing the URLs manually, but I'm afraid that's often not the case.
- as the pages might be accessed with the "non-clean" URLs directly, a <link rel="canonical" ...> has to be inserted to the pages, to avoid DC
- and finally the problems described at the end of section 4 of the cited wiki article
Christoph
Christoph M. Becker – Plugins for CMSimple_XH
Re: re: PLEASE give me CLEAN URLS!
I achieved some first somewhat promising results. In the following a fresh installation of CMSimple_XH 1.5.3 is assumed (including the default content), running under an Apache webserver. This is meant for demonstration and testing purposes only -- do not use in a production environment!
- add a new config option to cmsimple/config.php:
If CMSimple_XH is installed in a subfolder subfolder/ of the web root, you have to write:
Code: Select all
$cf['uri']['base']="/"
Code: Select all
$cf['uri']['base']="/subfolder/"
- insert in cmsimple/cms.php before line 186:
Code: Select all
$sn = $cf['uri']['base'];
- change cmsimple/cms.php line 656 to:
and line 659 to
Code: Select all
return '<a href="' . $sn . $u[0] . '">';
Code: Select all
return isset($u[$i]) ? '<a href="' . $sn . $u[$i] . (!empty($x) ? '?' . $x : '') . '">' : '<a href="' . $sn . (!empty($x) ? '?' . $x : '') . '">';
- add a .htaccess in the CMSimple_XH root folder:
Code: Select all
RewriteEngine on # To prevent loop: RewriteCond %{REQUEST_URI} !index.php # Do not rewrite requests to existing directories: RewriteCond %{REQUEST_URI} !css RewriteCond %{REQUEST_URI} !images RewriteCond %{REQUEST_URI} !downloads RewriteCond %{REQUEST_URI} !plugins RewriteCond %{REQUEST_URI} !templates RewriteCond %{REQUEST_URI} !userfiles # Do not rewrite requests with any query strings: RewriteCond %{QUERY_STRING} ^$ RewriteRule ^(.*)$ ./index.php?$1
- in cmsimple/cms.php after line 892 add:
Code: Select all
$t .= tag('base href="' . $cf['uri']['base'] . '"');
- in cmsimple/config.php change $cf['uri']['seperator']:
Code: Select all
$cf['uri']['seperator']="/";
- give it a try! Basically it should work, but you can't access any pages with special characters (e.g. "Templates & Plugins"). You have to avoid these characters, or make use of urichar_org/new. So change these in cmsimple/languages/en.php:
Code: Select all
$tx['urichar']['new']="and,"; $tx['urichar']['org']="&, – ";
- to have the URLs all lower case and with "-" instead of "_", change cmsimple/cms.php line 684:
Code: Select all
return str_replace('+', '-', strtolower(urlencode($s)));
- "Templates & Plugins" can't be called, as this is prohibited by the RewriteCond !templates. I'm quite sure, this can be solved, but I have to learn some more about mod_rewrite. If someone else has a solution at hand, please post it.
- second languages don't work. Again something that might be resolved using more sofisticated rewrite rules.
- The WYSIWYG editors won't get the stylesheet for pages not on toplevel (<h1>) as the <base> element is missing. This can perhaps be solved by some editor configuration.
- The DC issue. This has to be solved by a <link rel="canonical"> element.
- If one inserts a special character, that's not handled by urichar, to a page heading, the page can't be accessed anymore via the menu.
- and probably some more (at least) minor issues
Christoph M. Becker – Plugins for CMSimple_XH
Re: re: PLEASE give me CLEAN URLS!
I found out, that login is not possible at all with the current solution. So change the .htaccess to:
This will solve the issue that "Templates & Plugins" can't be accessed too. And you don't have to specify each directory as RewriteCond anymore.
To make the stylesheet available to the editor, just insert into plugins/tinymce/inits/init_*.js above the first option: or in case you have CMSimple_XH installed in a subfolder of the web root:
Still remaining problems:
Code: Select all
RewriteEngine on
# To prevent loop:
RewriteCond %{REQUEST_URI} !index.php
# Do not rewrite requests to existing directories and files:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Do not rewrite requests with any query strings:
#RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ ./index.php?$1 [QSA]
To make the stylesheet available to the editor, just insert into plugins/tinymce/inits/init_*.js above the first option:
Code: Select all
document_base_url: '/',
Code: Select all
document_base_url: '/the_subfolder/',
- second languages don't work.
- The DC issue. This has to be solved by a <link rel="canonical"> element.
- If one inserts a special character, that's not handled by urichar, to a page heading, the page can't be accessed anymore via the menu.
- and probably some more (at least) minor issues
Christoph M. Becker – Plugins for CMSimple_XH
Re: re: PLEASE give me CLEAN URLS!
im just a humble designer so i unfortunately cannot contribute but really appreciate the time you have given.
even if in the long term you find that the process is not 100% achievable', im sure it will be in the future.
i often go to http://www.opensourcecms.com/ to see what's out there and im glad contributers like yourself are helping to keep cmsimple fresh
even if in the long term you find that the process is not 100% achievable', im sure it will be in the future.
i often go to http://www.opensourcecms.com/ to see what's out there and im glad contributers like yourself are helping to keep cmsimple fresh
Re: re: PLEASE give me CLEAN URLS!
I'm quite confident, that it is possible to solve the "still remaining problems" in the near future. If so, it might be considered to integrate that as option to the core in XH 1.6. However, it's up to the plugin developers to make it possible to have clean URLs for the plugins too.kweku wrote:even if in the long term you find that the process is not 100% achievable', im sure it will be in the future.
We're currently preparing a publicly available demo of CMSimple_XH so we can finally list it there. I'm curious about the voting.kweku wrote:i often go to http://www.opensourcecms.com/ to see what's out there
Christoph M. Becker – Plugins for CMSimple_XH
Re: re: PLEASE give me CLEAN URLS!
Christoph M. Becker – Plugins for CMSimple_XH