Page 1 of 1
How do I create a subfolder...
Posted: Wed Aug 27, 2008 7:52 pm
by karc2007
Hi,
I posted this message before, but in the wrong forum - sorry for that. As I wrote already I´m jsut a bit scared, that I have a big problem.
i have a problem with the structure of my site and I need to create subfolders for articles.
for example:
http://mysite.com/politics/index.html
How can I create a page alias like this?
I tried putting: "/politics/index" into the alias-field. Well that doesnt work. It just been transformer to "politics-index.html"
So, whats the trick about it? Is is possible at all?
Im really scared at the moment.
thanks for any help,
Marc
Re: How do I create a subfolder...
Posted: Wed Aug 27, 2008 8:25 pm
by Nick Smart
Quick answer:
1. Create a page with an alias of "politics".
2. Create a page with an alias of "index" and set "politics" to be it's parent.
3. In config.php set:
Code: Select all
#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';
#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism? This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = false;
#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy? (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = true;
Your url will be
www.domain.com/politics/index.html
Nick
Re: How do I create a subfolder...
Posted: Wed Aug 27, 2008 8:50 pm
by karc2007
Thanks a lot! You are my hero.
This is a big step forward.
Now I have the problem, that my submenu is done like this.. i didnt do it myself
A page was created with this content:
{menu template='subnav' start_page='subnav'}
The page has no parent page.
All subcategories have to have "subnav" as parent to appear in the submenu.
Now, as a result of this technique every folder is created like this: /subnav/folder/page.html
Can I get rid of the "subnav" in some way?
Perhaps by htaccess?
Thanks for any help.
Re: How do I create a subfolder...
Posted: Wed Aug 27, 2008 9:11 pm
by Nick Smart
I assume there is a page called "subnav"? So is that the parent of "politics"? Sounds like you've got a page hierarchy that's one level too deep.
Take a step back. Draw it out on a piece of paper. Then re-organise your pages - page order, which pages are parents of which children, etc. perhaps delete some unecessary pages. Then re-think your {menu} statement and what the start_page should be.
Nick
Re: How do I create a subfolder...
Posted: Wed Aug 27, 2008 9:22 pm
by karc2007
Hi, thanks again. My problem is, that the whole sub-navigation is done with that sub-nav-technique. Without it, it doesn´t even appear. The subnav just builts the whole submenu, it doesn´t appear in the menu itself - its hidden. Again - I don´t know exactly, what the guy did, who built this up. I think he had a problem with configuring the submenu and biult a workaround.
Do I have to built in the submenu in a whole new way perhaps?
When this menu statement says: {menu template='subnav' start_page='subnav'}. Can I jsut put in: {menu template='subnav' start_page=''} or {menu template='subnav' start_page='/'} ? How has the "start_page" have to be set, to be the root?
Thanks for your help so far.
Re: How do I create a subfolder...
Posted: Wed Aug 27, 2008 9:34 pm
by Nick Smart
Maybe he's done something with a rewrite rule if you look through your htaccess file.
Nick
it doesn´t look like it was done in htaccess.
Posted: Wed Aug 27, 2008 11:45 pm
by karc2007
At least, i couldn´t find anything extraordinary. Most of the stuff in my htacess is for blocking spambots.
But I dont´have that much experience with htacess.
I think thats the parts, that do the redirects, right?
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]
The rest of the htaccess is just for spam bots.
And if it does help:
You can see my site here:
http://indonesia-portal.de
As you may notice, all URLs are on the root level and I don´t want to keep it like this for ever. I think even with a /subnav/ (I will choose at least a better name for it, its better than the current state. (Oh my, so much 301 to do.)
Would be great, if you can give a hint, seeing my htacess, but even if not, thanks for trying.
Marc
Re: How do I create a subfolder...
Posted: Thu Aug 28, 2008 11:29 pm
by Dr.CSS
Is the subnav page or whatever it is set as not shown in menu? it should be...
Re: How do I create a subfolder...
Posted: Fri Aug 29, 2008 11:10 pm
by karc2007
Yes. its set to "active", but also to "not show" already.
Re: How do I create a subfolder...
Posted: Thu Jul 08, 2010 9:56 am
by pawi
Hello,
i also posted this in the german forum,
(
http://forum.cmsmadesimple.org/index.ph ... 412.0.html )
but would like to try my luck here as well as you have posted an excellent solution for pretty URLs that works great for me (thanks!)
The only problem I have right now is that I use html in my Menu-Titles which create the subfolder names in my URL. As I use a lot of soft hyphenation with my URL-subfolders look like this
http://domain.com/DE/super-shy-cali-shy ... index.html
How can I get rid of the -shy-s or any other HTML that i will maybe use in my Menu titles?
Thank you in advance
*Pawi
//edit: ummm..... a SHY pullback.. i will edit my site-alias and everything is fine
)