Page 1 of 1

[SOLVED] News Module - custom URL not working

Posted: Thu Jan 09, 2014 12:39 am
by fearmydesign
Hi everyone. Ok, I've done this many times, I really don't know what's going on with me today! I can't figure this one out.

PROBLEM

When I create a News Module article, if I use the custom URL: field, it will NOT display on the site and gives a NOT FOUND error. See what I mean here: http://www.lifethisway.com/how-to-delet ... -analytics

BUT if I leave the custom URL field blank, the article display fine, but under this format (which I don't want, I want custom URLs): http://www.lifethisway.com/news/7/20/Snow-in-December

Confused. I have pretty URL's enabled and they work fine, see a page here: http://www.lifethisway.com/photography

RESEARCH

I found several threads, but none helped me fix this particular problem. My pretty urls are working fine, and I double checked all the right settings/code on the .htaccess file and mod_rewrite on the config file.

I also tried changing to different pages and leaving blank the "Default Page for Detail Views" under Options.

I went one step further, and compared it to another site where I have the exact same scenario. I compared the Summary Templates, Detail Templates, and settings. Everything checked out good, so I don't know what else to try.

Some of the threads I looked at:

http://forum.cmsmadesimple.org/viewtopi ... rl#p307325

http://forum.cmsmadesimple.org/viewtopi ... rl#p306368

http://forum.cmsmadesimple.org/viewtopi ... rl#p306066

System Maintenance = No structural errors were detected in the database
System Information Looks good, except for Maximum Execution Time & Maximum Post Size which have the yellow warning sign /!\

SYSTEM IN USE

I am using CMSMS version 1.11.9 - latest. All modules up to date including CGExtensions (1.38.1). I only use a hand full of modules, most CalGuys, but here's the actual list of modules in use:

CGExtensions 1.38.1
CMSMailer 5.2.2
CMSPrinting 1.0.5
Captcha 0.4.6
FileManager 1.4.3
FormBuilder 0.7.4
Gallery 1.6.1
MenuManager 1.8.6
MicroTiny 1.2.5
ModuleManager 1.5.5
News 2.14.1
Search 1.7.11
SiteMapMadeSimple 1.2.7
ThemeManager 1.1.8
TinyMCE 2.9.12

I know that it's probably something really small... but I can't seem to put my fingers on it, any suggestions please? Thank you :-\

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 1:23 am
by calguy1000
I just tested this and it worked fine.

Try using the 'Update Routes' option in system maintenance.

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 2:44 am
by fearmydesign
calguy1000 wrote:I just tested this and it worked fine.

Try using the 'Update Routes' option in system maintenance.
Thanks Calguy, I tried that, and also clearing cache... but I still get the same error. When you said you tested this and it worked, were you referring to clicking on my links? and they worked?...

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 2:47 am
by calguy1000
No I tested the custom url functionality for news articles on my install.

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 3:28 am
by JohnnyB
Try setting the detailpage='some-page-alias' in your {News} tag and place the {News} tag in the detail page as well.

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 7:36 am
by Rolf
The error page shown is the webhost 404-page, not the CMSMS one.
Perhaps try to disable the host one and try again...

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 8:25 pm
by fearmydesign
Rolf wrote:The error page shown is the webhost 404-page, not the CMSMS one.
Perhaps try to disable the host one and try again...
Thanks Rolf, I added the CMSMS Error page now... but that doesn't solve the problem I have. Still trying to figure this out (scratching my head) ???

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 8:34 pm
by fearmydesign
JohnnyB wrote:Try setting the detailpage='some-page-alias' in your {News} tag and place the {News} tag in the detail page as well.
Thanks Johnny, I tried this but for some reason, the articles just DO NOT want to display when I give them a custom URL... this is really weird (still scratchin my head) ???

Under News Module settings (Default page to use for detail views): I have | 2. Thoughts | selected.

Then, on Thoughts page content, I have: {News category='thoughts'}

I also tried combinations of:
{news} * lowercase
{News} * uppercase
{News category='thoughts' detailpage='thoughts'}
{news category='thoughts' detailpage='thoughts'}
{news category="thoughts" detailpage="thoughts"} * quotes
{News category='thoughts'}
{News detailpage='thoughts'}
{news detailpage='thoughts'}

Do you think it could be because the detailpage & category have the same exact name (thoughts) ?

.HTACCESS + CONFIG FILE CODE

Posted: Thu Jan 09, 2014 8:39 pm
by fearmydesign
Here is the code for both htaccess and config file just in case! Thank you

CONFIG

Code: Select all

<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'host';
$config['db_username'] = 'usname';
$config['db_password'] = 'uspsswd';
$config['db_name'] = 'dbname';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'America/New_York';
$config['url_rewriting'] = 'mod_rewrite';
$config['use_hierarchy'] = true;
?>
.HTACCESS

Code: Select all

# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# This is important, so uncomment if your host permit
#Options -Indexes
#ServerSignature Off
#php_value session.cookie_httponly true

#Options +FollowSymLinks

# To prevent E_STRICT problems with PHP 5.3+ you can uncomment the following lines
# Note: These settings should only be enabled for production sites!
#php_flag display_startup_errors 0
#php_flag display_errors 0
#php_flag html_errors 0
#php_value docref_root 0
#php_value docref_ext 0

<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#RewriteCond %{REQUEST_METHOD} !POST$
#RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

RewriteCond %{HTTP_HOST} ^lifethisway\.com$ [NC]
RewriteRule ^(.*)$ http://www.lifethisway.com/$1 [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>

<IfModule mod_headers.c>
# Disable ETags
Header unset ETag
FileEtag None
# For Security
Header set X-Frame-Options "SAMEORIGIN"
</IfModule>

<IfModule mod_deflate.c>
# Compress css, plaintext, xml, gif, and images in transport.
AddOutputFilterByType DEFLATE text/css text/plain text/xml image/gif image/jpeg image/png
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
# Set expires tags on various file types... so that the browser wont attempt to reload them.
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/ico "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType video/x-flv "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/css "access plug 1 month"
<IfModule mod_headers.c>
  # Setting cache control to public allows proxy servers to cache the items too.
  Header set Cache-Control "public"
</IfModule>
</IfModule>

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 8:53 pm
by JohnnyB
I'm still a bit stumped and would like to check it out in more detail.

Here are a few observations:

http://www.lifethisway.com/news/7/20/Snow-in-December (link provided in your first post)
* and *
http://www.lifethisway.com/news/7/24/Snow-in-December (the link in the right column)
might generate duplicate content in Google. The '20' and '24' are your landing page ID's. The '7' is the article ID.
(it doesn't even need the Snow-in-December alias to load)
(make sure you have Canonical links set up correctly in your News detail template and Layout Templates)

Setting a detailpage="the-same-page" for all {News} tags will be helpful. Setting that landing page preference helps to eliminate links to the same content with different landing page IDs in the URL.


Other ideas:
For some reason (I can't remember why), when using the News module, I always needed a page that uses the 'news' page alias. It just always seems to work better for me and I remember having inconsistencies when I didn't use that as my news landing page. I know the module has changed over the last couple years, but I still do this.

The other thing worth mentioning is that I always use the CGBlog module when the main intention is to have a blog article section on a site. I use News for more simple arrangements and usually only for announcements and such.

It might be worth testing News with a 'news' landing page and setting that as the detailpage in every tag and in the preferences.

And, it might be worth installing CGBlog and testing that module and see which one works best for you.

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 8:58 pm
by JohnnyB
You can remove $config['use_hierarchy'] = true; from the config.php as it is now obsolete.

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 9:11 pm
by fearmydesign
JohnnyB wrote:I'm still a bit stumped and would like to check it out in more detail......
Thanks Johnny, first here is the canonical code located at the top of News detail template:

Code: Select all

{if isset($entry->canonical)}
  {assign var='canonical' value=$entry->canonical}
{/if}
Second, I created another page http://lifethisway.com/blog to hold the {News} and also made this the default landing page for detail views under news options.

Then I added the detailpage {News detailpage='blog'} but didn't work... ???

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 9:36 pm
by JohnnyB
Ok, but is the canonical link set properly in the layout template that holds the page blog? I don't see it. Try setting (for SEO not to fix your problem):

Code: Select all

{if isset($canonical)}<link rel="canonical" href="{$canonical}">{elseif isset($content_obj)}<link rel="canonical" href="{$content_obj->GetURL()}">{/if}
Ok, can you do the same thing using a page with alias, 'news'?
http://lifethisway.com/news ?
Just in case that actually helps... :-\ I don't know for sure that it will help, but I always had to do it like that in the past.

Re: News Module - custom URL not working

Posted: Thu Jan 09, 2014 9:56 pm
by fearmydesign
JohnnyB wrote:Ok, can you do the same thing using a page with alias, 'news'?
http://lifethisway.com/news ?
Just in case that actually helps... :-\ I don't know for sure that it will help, but I always had to do it like that in the past.
Man :-\ what is going on!! I changed the alias to 'news' but not working... ???

Re: News Module - custom URL not working

Posted: Tue Jan 14, 2014 2:22 am
by fearmydesign
Guys, I'm sorry... as I figured, this was a stupid mistake - to say the least - I had forgotten to rename a file on the server. I had renamed it a few weeks back while testing stuff out, but never changed back and didn't work on it again, so I forgot!!

Thanks everyone for your help. :)