Posts: 524
Threads: 48
Joined: Mar 2011
2011-06-25, 04:42:17
(This post was last modified: 2011-06-25, 04:42:59 by infos.media.)
I'm looking for help with mod_rewrite: I'd like to remove /index/ from subpage paths beneath the start page in GS.
http://www.get-simple.de/index/was-ist-getsimple/ should generally become http://www.get-simple.de/was-ist-getsimple/.
I clicked on the second example above, just out of curiosity if it would work, and it does! No 404, so it should be possible to remove the /index/ altogether?
Posts: 1,204
Threads: 30
Joined: Jun 2010
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index/$1 [L]
?
Addons: blue business theme, Online Visitors, Notepad
Posts: 2,906
Threads: 193
Joined: Feb 2011
yojoe Wrote:RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index/$1 [L]
I tested that in the .htaccess but the links to subpages in the submenu were not modified, so calling these subpages the URLs still contained /index/ and by that I ran into an error
Posts: 3,491
Threads: 106
Joined: Mar 2010
2011-06-25, 20:29:40
(This post was last modified: 2011-06-25, 21:15:55 by fotothink.)
polyfragmented Wrote:I'm looking for help with mod_rewrite: I'd like to remove /index/ from subpage paths beneath the start page in GS.
http://www.get-simple.de/index/was-ist-getsimple/ should generally become http://www.get-simple.de/was-ist-getsimple/.
I clicked on the second example above, just out of curiosity if it would work, and it does! No 404, so it should be possible to remove the /index/ altogether?
The plugin you use to generate the breadcrumbs should not include "index" in the link... Edit: No, sorry.. I presume it's just that was-ist-getsimple has index as parent. Why not make it a top level page instead?
GetSimple's default rewriterule allows anything between the base url and the slug. Other links that work are:
http://www.get-simple.de/loremipsum/was-ist-getsimple/
http://www.get-simple.de/lorem/ipsum/foo...getsimple/
....
This 'feature' is not a problem for search engines, the correct canonical url (defined by your custom/fancy permalink settings) is in the header:
Code: <link rel="canonical" href=...
If you want to enforce the url structure (fancy or custom) you have defined in your GS settings, you can edit gsconfig.php and enable canonical redirection:
Code: # Enable Canonical Redirects?
define('GSCANONICAL', 1);
However this does not work properly with pages that use url parameters (news managers, galleries, etc.).
It would be nice a plugin that does this, but letting you exclude certain slugs (like SimpleCache does, as it is exactly the same 'problem').
Posts: 1,204
Threads: 30
Joined: Jun 2010
2011-06-25, 23:56:05
(This post was last modified: 2011-06-25, 23:57:01 by BlackRose.)
Connie Wrote:I tested that in the .htaccess but the links to subpages in the submenu were not modified, so calling these subpages the URLs still contained /index/ and by that I ran into an error
Rewrite works as supposed, and redirects user where he should be redirected.
Rewrite doesn't interfere into script's code. It may work along with it (passing some variables), but it does not override script's output text. You have to change it manually according to what you want to achieve.
But then rewrite rules wouldn't be needed.
Addons: blue business theme, Online Visitors, Notepad
Posts: 2,906
Threads: 193
Joined: Feb 2011
Carlos Wrote:I presume it's just that was-ist-getsimple has index as parent. Why not make it a top level page instead?
Carlos, because the space for toplevel-pages is limited and we want to keep that as sub-page of the homepage
I think there is no real solution as the rewrite-rules plus the plugin-outputs must fit together ;=(
Posts: 3,491
Threads: 106
Joined: Mar 2010
2011-06-26, 01:21:19
(This post was last modified: 2011-06-26, 01:23:16 by fotothink.)
Connie Wrote:because the space for toplevel-pages is limited and we want to keep that as sub-page of the homepage
Why not use a top level generic page like 'site', 'web',... as parent of those main pages?
PS I don't understand what limitation there is... You can have top level pages that are not shown in the navigation menu, don't you?
Posts: 3,491
Threads: 106
Joined: Mar 2010
Anyway here's a patch: edit /admin/inc/basic.php, at the beginning of function find_url(), line 349, insert:
Code: if ($parent=='index') $parent='';
Posts: 2,906
Threads: 193
Joined: Feb 2011
Carlos,
I know that. But we wanted to have these pages under the HOME, shown in the right sidebar
so placing them under another, even not menu-visible page, is not our idea
and we were pondering why there must be this "index" and how to rename it if it is necessary ;=)
Cheers, Connie
Posts: 524
Threads: 48
Joined: Mar 2011
Carlos Wrote:if ($parent=='index') $parent=''; Thanks, that seems to work.
As far as "what-is-getsimple" goes, it was merely an example of what I wanted to get rid off. It's no matter of SEO or page placement either, I just don't see the need for /index/child-page/ as opposed to /some-top-level-navi/child-page/. While the system basically works that way, it looks broken to me, hence my request.
I appreciate your invested time and the working patch you delivered. Again, thanks. +1
Posts: 6,266
Threads: 181
Joined: Sep 2011
This is inline with how file based websites work
index is sibling of all other pages
There is no such thing as
index/pages
Not sure why you would want to do this.
Index is an index not a parent
as such index/index makes no sense
I would even go so far to say, we should not let index even be a parent option.
Posts: 321
Threads: 15
Joined: Feb 2012
2014-12-14, 21:46:47
(This post was last modified: 2014-12-14, 21:52:36 by D.O..)
Hi mates,
I got the same problem but at the moment I resolved in this way without modyfing GS
(this solution is good for a site with News Manager & I18N plugins)
PHP Code: <div id="breadcrumbs"> You are here <?php if ($parent!='index') { ?> » <a href="<?php echo find_url('index',null); ?>">Home</a><? } get_i18n_breadcrumbs(return_page_slug()); if (nm_is_single()) { ?> » <a href="<?php nm_post_url(); ?>"><?php nm_post_title(); ?></a><?php } ?></div>
This about the "breacrumbs" but the problem continues with the url structure
example:
http://sitename.com/index/page/subpage
P.S.
Thanks to Carlos for showing me this post.
My website made with GetSimple CMS is
Arte & Società
www.artesocieta.eu
An indipendent website about Italian Contemporary Visual Arts
|