Two CMSMS sites of mine (versions 1.3.1 and 1.2.5). They use pretty URLs with mode_rewrite.
What CMSMS does:
Let's say my default page is mydomain.com/last_news. All links to the default page point to the root "mydomain.com". And when I visite mydomain.com I am redirected to last_news... though the browser's address bar keeps showing "mydomain.com". I didn't see any problem about that -- until now.
The problem
I was putting sponsored links in the most visited pages, and of course the default page is among them. I created a personalized tag with the ads company's code and added it to the template in certain pages, depending on a content field used as flag. Everything worked fine: demo links appeared in the selected pages... except the default page: the ads company's robot didn't find the links in it...! I had registered "mydomain.com" as the default page, so I removed it from the list and registered "mydomain.com/last_news" instead... No way: the URL was not accepted by the company because it's not indexed in Google! Of course it's not, it's hidden!
I googled into cmsmadesimple.org looking for a solution or a clue, but didn't find anything.
The solution
I thought I could solve this with the Apache's .htaccess file as usual, but the CMSMS's default page is mandatory anyway and it would interfere. I had a simpler idea:
1. Redirection tag
I created a personalized tag called "redirect_to_default":
Code: Select all
header( 'HTTP/1.1 301 Moved Permanently' );
header( 'Status: 301 Moved Permanently' );
header('Location: http://mydomain.com/last_news');
I created an empty template "redirect_to_default", with only one line:
Code: Select all
{redirect_to_default}
I created an empty page (not really empty: one space is mandatory) called "index". Its template has to be "redirect_to_default". It must not appear in menus. Not cacheable. I marked it as the default page.
The result
Now I visit "mydomain.com" and I am clearly redirected to "mydomain.com/last_news". Also, "last_news" is showed in the menus. That's what I wanted. Now I will be able to put payed links into my default page... but I have to wait for Google to index it!!
I'm not an CMSMS expert. I wonder if there's a simpler or more elegant solution way to achieve this, or any new option in versions newer than 1.3.1. I think It would be useful to choose the desired behaviour in the site admin, with a single tick.
Cheers,
Marcos