Page 1 of 1

[SOLVED] Pretty URLs not working

Posted: Sat May 17, 2014 2:26 am
by michaywood
My server is a Debian GNU/Linux operating system.

I followed the instructions at
http://docs.cmsmadesimple.org/configuration/pretty-url

After doing the steps, the homepage will load, then when I click onto another page (like mysite.com/index.php/about) it takes me to an error page saying

The requested URL index.php/about was not found on this server.

I've never flirted with Pretty URLs before so have pretty limited knowledge of working with them in CMSMS

Re: Pretty URLs not working

Posted: Sat May 17, 2014 5:20 pm
by velden
A few possible causes:

- mod_rewrite is not available/enabled on your web server
- you did NOT copy htaccess.txt from /docs directory but copied .htaccess
- you did copy the right file but forgot to rename it to .htaccess
- ...

Re: Pretty URLs not working

Posted: Sat May 17, 2014 5:40 pm
by Jo Morg
Also, if you are running CMSMS on a sub-folder of the domain you will need to set RewriteBase accordingly on this bit:

Code: Select all

#Sub-dir e.g: /cmsms
RewriteBase /
Assuming that the sub-folder is cmsms, change to:

Code: Select all

#Sub-dir e.g: /cmsms
RewriteBase /cmsms
PS: I just noticed
... when I click onto another page (like mysite.com/index.php/about) it takes me to an error page saying
Do you mean that you have: $config['url_rewriting'] = 'internal';?

[SOLVED] Re: Pretty URLs not working

Posted: Sun May 18, 2014 8:36 pm
by michaywood
thanks for the input! I had done the .htaccess and config.php changes correctly, but assumed since .htaccess was in my sub-folder mysite.com/myfolder that it wouldn't need the subdir rewrite base. Once I changed that in the .htaccess to /myfolder, it worked! Thanks again, y'all!

Re: Pretty URLs not working

Posted: Mon May 19, 2014 2:59 am
by michaywood
This fixed my main issue with pretty url's, but now I'm noticing a secondary problem with children.

All parent pages links work, but any children links aren't working as it's trying to go to mysite.com/myfolder/parent/child and loads the page text, but there is no styling and is just content on a white background. However, if I manually go to mysite.com/myfolder/child, the page loads correctly.

Any ideas on how to get children nav links to work correctly with Pretty URLs?

Re: Pretty URLs not working

Posted: Mon May 19, 2014 5:49 am
by Jos
Please check if you have a {metadata} tag in the head section of your page template

Re: Pretty URLs not working

Posted: Mon May 19, 2014 2:17 pm
by michaywood
just double checked and there is a {metadata} in the <head> of my template.

not sure if it matters, but this CMSMS is under a folder mysite.com/myfolder

Re: Pretty URLs not working

Posted: Mon May 19, 2014 2:25 pm
by velden
Posting a link might help to solve problem faster.

Posting page template can help too.

Re: Pretty URLs not working

Posted: Mon May 19, 2014 2:29 pm
by Jo Morg
Additionally check your source html (on your browser -> view source) for <base href="<some value here>" />. This should be present, and correctly reflect the url from the domain root up to your installation root for relative links. Shouldn't be a problem for absolute links.

Re: Pretty URLs not working

Posted: Mon May 19, 2014 2:50 pm
by michaywood
I added <base href="http://www.mysite.com/myfolder/" /> to my page template, cleared cache and tried and still the same issue.

Unfortunately the site isn't live yet, so the sitedown message is turned on so can't just post link to page, but below is all code in my page template up until the starting </__body> tag.

Code: Select all

{process_pagedata}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
{literal}<__script__ type="text/javascript" src="//use.typekit.net/tkr3ikq.js"></__script>
<__script__ type="text/javascript">try{Typekit.load();}catch(e){}</__script>{/literal}
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="css/foundation.css" />
    <link rel="stylesheet" href="css/mytouches.css" />
    <__script__ src="js/vendor/modernizr.js"></__script>
<title>{sitename} - {title}</title>
{metadata}
{cms_stylesheet}
<base href="http://www.mysite.com/myfolder" />
</head>
I'm using Zurb's Foundation 5 + TypeKit to build this, thus the reason for a few of the link/script tags above.

EDIT: not sure why it's adding those _ _ to my code, but those are not there in the code

Re: Pretty URLs not working

Posted: Mon May 19, 2014 2:56 pm
by Jo Morg
michaywood wrote:I added <base href="http://www.mysite.com/myfolder/" /> to my page template, cleared cache and tried and still the same issue.
Note that {metadata} should do this for you. I just asked if you could find it as you could have used {metadata showbase=false} preventing the tag to be rendered.

Re: Pretty URLs not working

Posted: Mon May 19, 2014 2:58 pm
by michaywood
i don't see a base href in my page source, but I simply have the {metadata} tag with no other info inside it, like showbase=false.

Re: Pretty URLs not working

Posted: Mon May 19, 2014 3:16 pm
by velden

Code: Select all

<link rel="stylesheet" href="{root_url}/css/foundation.css" />
    <link rel="stylesheet" href="{root_url}/css/mytouches.css" />

[SOLVED] Re: Pretty URLs not working

Posted: Mon May 19, 2014 3:20 pm
by michaywood
boom. problem solved. Thanks!

adding {root_url} to my header did the trick