Page 1 of 1

[closed-New Topic]Rewriting all URLs to abolute base path

Posted: Sat Mar 21, 2009 8:42 pm
by CWebguy
Ok, I can do this with any site, but I am wondering how you would approach this with CMSMS.

I'm wanting to do a URL structure like
subfolder/123.html
or just
subfolder/123

at the very least I'll settle for
subfolder/pagename

I can do the mod rewrites fine, wondering if I'm going to hack at the core, and where to start!

Thanks.

Re: Rewriting all URLs to abolute base path

Posted: Sat Mar 21, 2009 8:51 pm
by RonnyK
If you mean with subfolder, the parent/child in the menu, then you could do the following.

Copy the htaccess.txt from the /doc folder and put it in the root folder as .htaccess.

Then in the config.php change.
"Assume mod_rewrite"
"Use Hierachy Name"

And put ".html" in
"Page Extension"
Ronny

Re: Rewriting all URLs to abolute base path

Posted: Sat Mar 21, 2009 8:56 pm
by CWebguy
But I'm guessing I also need to change something in the core to change what links appear.

I'm going to take a wild guess and say the "menu manager".

Thanks by the way.

Re: Rewriting all URLs to abolute base path

Posted: Sat Mar 21, 2009 8:59 pm
by RonnyK
With the logic I posted earlier, the links will appear like www.domain.com/parent/child/page.html

What other rewrite are you referring to?

Ronny

Re: Rewriting all URLs to abolute base path

Posted: Sat Mar 21, 2009 9:25 pm
by CWebguy
well the parent/child/page.htm is what I have now.

I wanted it to be something like

foldernameichoose/1245    (12345 being the page ID #)

I guess I will need to look at the database to get a bigger understanding of the way everything works.  Maybe write my own menu function.

Re: Rewriting all URLs to abolute base path

Posted: Sat Mar 21, 2009 10:57 pm
by CWebguy
I guess I'm in for a major overhaul  Be prepared for questions :)

Re: Rewriting all URLs to abolute base path

Posted: Sun Mar 22, 2009 8:36 am
by RonnyK
OK, you mean the page-id instead of the alias to be passed to the URL?

What about making the alias then hold the page-id....

Ronny

Re: Rewriting all URLs to abolute base path

Posted: Sun Mar 22, 2009 2:26 pm
by CWebguy
Interesting, I would still have to change the {content} to call the page ID instead of the content_name? no?

Re: Rewriting all URLs to abolute base path

Posted: Sun Mar 22, 2009 3:13 pm
by RonnyK
It would mean, that you make the page_alias, which is set on the options-tab, to hold the id of the page. When you have autofill on in config.php for page-aliasses, it will make the alias, hold the page-name in lowercase, with spaces converted to a -.
You could either go to all the pages, and fill that field to hold the id instead. Or find some logic that does it for you.

Be aware that when modifying the core-sources, that support will be difficult, and that upgrade will become harder as well...

Ronny

Re: Rewriting all URLs to abolute base path

Posted: Tue Mar 24, 2009 4:37 pm
by CWebguy
Hey thanks Ronny, I repped you.

Now how about removing the Child Element from each URL?

I have figured that if I just wanted:

example.com/parent/pagename

regardless, even if the current page is a child.

Any ideas?  It doesn't have to be the page ID in the alias for this one.  Maybe I'll start a new thread on this if no responses.

Thanks!

Re: Rewriting all URLs to abolute base path

Posted: Wed Mar 25, 2009 12:01 am
by Dr.CSS
Why you going thru all this, if you don't mind my asking?...

Re: Rewriting all URLs to abolute base path

Posted: Wed Mar 25, 2009 12:36 am
by CWebguy
well, there is a site I want to work on, and right now I'm realizing I'm going to get very long URLs, so I'm wanting to cut everything down and keep it neat.  I just want four main categories(parents) that everything is grouped under.  If it's too hard I won't worry about it, but if someone had a solution it would definitly be helpful.

Thanks mark.
Lance

Re: Rewriting all URLs to abolute base path

Posted: Wed Mar 25, 2009 5:03 pm
by viebig
it´s possible and easy but will need core modifications so.. any upggrade of the system would need a modification

Re: Rewriting all URLs to abolute base path

Posted: Wed Mar 25, 2009 5:06 pm
by Dr.CSS
It sounds like you just need to make the parent pages and put all your child pages under them, that will give you yoursite.com/parent/child urls and they will be 'clean' if you use mod_rewrite with .htaccess...