[SOLVED] Pretty URLs not working

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am

[SOLVED] Pretty URLs not working

Post 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
Last edited by michaywood on Mon May 19, 2014 3:21 pm, edited 3 times in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Pretty URLs not working

Post 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
- ...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: Pretty URLs not working

Post 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';?
"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!
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am

[SOLVED] Re: Pretty URLs not working

Post 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!
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am

Re: Pretty URLs not working

Post 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?
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Pretty URLs not working

Post by Jos »

Please check if you have a {metadata} tag in the head section of your page template
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am

Re: Pretty URLs not working

Post 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
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Pretty URLs not working

Post by velden »

Posting a link might help to solve problem faster.

Posting page template can help too.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: Pretty URLs not working

Post 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.
"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!
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am

Re: Pretty URLs not working

Post 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
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: Pretty URLs not working

Post 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.
"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!
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am

Re: Pretty URLs not working

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Pretty URLs not working

Post by velden »

Code: Select all

<link rel="stylesheet" href="{root_url}/css/foundation.css" />
    <link rel="stylesheet" href="{root_url}/css/mytouches.css" />
michaywood
Power Poster
Power Poster
Posts: 280
Joined: Thu Apr 15, 2010 12:27 am

[SOLVED] Re: Pretty URLs not working

Post by michaywood »

boom. problem solved. Thanks!

adding {root_url} to my header did the trick
Locked

Return to “[locked] Installation, Setup and Upgrade”