Page 1 of 1

Pretty URLs

Posted: Sun Feb 02, 2014 6:11 pm
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.

Re: Pretty URLs

Posted: Sun Feb 02, 2014 6:17 pm
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

Re: Pretty URLs

Posted: Sun Feb 02, 2014 7:31 pm
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.

Re: Pretty URLs

Posted: Sun Feb 02, 2014 7:40 pm
by staartmees
The htaccessfiles in the subdirectories are there because the htaccess in a subdirectory is taking precendence over the root htaccess

Re: Pretty URLs

Posted: Sun Feb 02, 2014 8:45 pm
by Jo Morg

Re: Pretty URLs

Posted: Sun Feb 02, 2014 10:49 pm
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.

Re: Pretty URLs

Posted: Mon Feb 03, 2014 5:11 am
by staartmees
Config.php tells your cms to use pretty url's.
Htaccess does the same on serverlevel.

Re: Pretty URLs

Posted: Mon Feb 03, 2014 9:42 am
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.

Re: Pretty URLs

Posted: Mon Feb 03, 2014 5:47 pm
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?

Re: Pretty URLs

Posted: Mon Feb 03, 2014 8:15 pm
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...

Re: Pretty URLs

Posted: Mon Feb 03, 2014 8:39 pm
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.

Re: Pretty URLs

Posted: Tue Feb 04, 2014 4:17 pm
by Dr.CSS
The only htaccess file you should touch is the one we already talked about...

Re: Pretty URLs

Posted: Tue Feb 04, 2014 4:37 pm
by KitchM
Thanks for the good rule of thumb. I will remember that.