Pretty URLs

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Pretty URLs

Post by KitchM »

I tried to utilize Pretty URLs as described at http://docs.cmsmadesimple.org/configuration/pretty-url. However, there appears to be a problem with it and I may have gotten myself in too deep.

Basically, I have lost all access to one particular domain, as well as the admin access to CMSMS. Can't remember all the things I've tried to do to recover. Probably made it worse.

Here are a couple questions:

1. I just installed a fresh CMSMS for another domain, and that one has no .htaccess file in /home/mydomain/. Why should my other domain have one?

2. Step 2 states "Add to the bottom of your website's config.php:". As there may be more than one such file, is this the one in the root of the domain?

Thanks.
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: Pretty URLs

Post by frankmanl »

1. I just installed a fresh CMSMS for another domain, and that one has no .htaccess file in /home/mydomain/. Why should my other domain have one?
You don't have to have an .htaccess file. Several sites I set up do perfectly well without one.
But ... if you e.g. want to have pretty URLs, .htaccess is there to arrange that.
2. Step 2 states "Add to the bottom of your website's config.php:". As there may be more than one such file, is this the one in the root of the domain?
As far as I kow you only have one config.php file in your CMSMS installation and yes, that 's in the root.

Frank
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Pretty URLs

Post by KitchM »

So while other program installations may have them, such as /home/mydomain/public_html/limesurvey/application/config/config.php, CMSMS only has the one. That makes sense.

Why doesn't the same thing hold true for .htaccess? There are many scattered thru various directories under the CMSMS installation.

Thanks much.
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Pretty URLs

Post by staartmees »

The htaccessfiles in the subdirectories are there because the htaccess in a subdirectory is taking precendence over the root htaccess
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: Pretty URLs

Post by Jo Morg »

"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Pretty URLs

Post by KitchM »

Thanks all. In fact I shouldn't have asked that last question. That was stupid of me. I had already read all about that and understood it.

I was more interested in the relationship of the two files when it comes to pretty URLs. I really don't see what they have to do with them.
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Pretty URLs

Post by staartmees »

Config.php tells your cms to use pretty url's.
Htaccess does the same on serverlevel.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Pretty URLs

Post by velden »

config.php tells cmsms to GENERATE pretty urls.
So all links in the menu, cms_selflink, canonical urls and maybe some other links modules generate.

However, cmsms will not understand those links. It needs something like

index.php?page=alias

That's where .htaccess comes in; it translates the pretty url a visitor/browser uses to something cmsms can understand.
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Pretty URLs

Post by KitchM »

Ah... okay. Let me see if I have this right:

1. So one must place the code:

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
at the end of the config.php file, located in the root of the domain, as in /home/mydomain/ (or is it /home/mydomain/public_html/?), and this will allow the Pretty URLs to be generated.

2. Then one must substitute the .htaccess found in the root of the domain (same location question as above) with the one found in /doc, as supplied by CMSMS named htaccess.txt, by copying it and renaming to overwrite existing one. This then makes it possible for the system to interpret the Pretty URLs created by the action in number 1 above.

What about the other .htaccess files found in other directories? They are there to control access to them; the other part of what .htaccess files do as I understand it. But don't they have to have the information added from htaccess.txt as well?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Pretty URLs

Post by Dr.CSS »

The path is most times /public_html where you unpack the CMSMS files, you should be able to find the admin folder there to make sure...

Yes, add those 2 lines to the config.php, then copy [root]/doc/ htaccess.txt into [root] and rename to .htaccess...

The other .htaccess files are only to limit access to those folder they are in and no they don't need any more code added to them...
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Pretty URLs

Post by KitchM »

Thanks, Doc, for verifying that for me. I thought I got it but was not sure.

What is the rule for knowing which .htaccess files should be edited and which do not need to be or should not be?

Thanks again.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Pretty URLs

Post by Dr.CSS »

The only htaccess file you should touch is the one we already talked about...
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Pretty URLs

Post by KitchM »

Thanks for the good rule of thumb. I will remember that.
Post Reply

Return to “The Lounge”