Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
My website's home page file is news.php. I have enabled pretty urls and have added the output of gen_htaccess.php to my root folder's htaccess file. The url that appears for news.php is "http://www.example.com/news/", while the news items I post follow the pattern "http://www.example.com/news/article-title.html". Nevertheless, I don't like the idea of visiting my domain and landing at "http://www.example.com/news/". Ideally I would like someone visiting the home page to stay on the domain url: "http://www.example.com/". Additionally, would it be possible for a modification to be made that produces a "prettier" url for the news items such as "http://www.example.com/news/article-title/". In the past I have only written relatively simple statements with mod_rewrite and after looking at the output of gen_htaccess.php, I really don't know how to produce the aforementioned outcomes. Any assistance with this matter would be greatly appreciated. The relevant sections of my htaccess are as follows:
Code: Select all
Options +FollowSymlinks -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule . - [L]
#news.php
RewriteRule ^news$ "$0/" [R=301,L,QSA]
RewriteRule ^news/$ news.php [L,QSA]
RewriteRule ^news/.*?([^\.\/]*)\.html$ news.php?pname=$1 [L,QSA]
RewriteRule ^news/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ news.php?d=$1$2$3 [L,QSA]
RewriteRule ^news/[^\.]*?([^/\.]*)/$ news.php?fname=$1 [L,QSA]
RewriteRule ^news/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]
</IfModule>

Lastly, the permissions in my couch folder have defaulted to 705 for folders and 604 for files. With security in mind, are these acceptable permission levels?
Ideally I would like someone visiting the home page to stay on the domain url: "http://www.example.com/"

.. and still see a listing of the news items. Right?

The simplest way of doing this is to create a template 'index.php' (this is the one that would get invoked when somebody visits your home page).
In this template place the code that lists the news items e.g.
Code: Select all
<cms:pages masterpage='news.php' limit='10' paginate='1'>
   ...
   <a href="<cms:show k_page_link />"><cms:show k_page_title /></a>
   ...
</cms:pages>

- basically repeat the code that you currently have in the 'list-view' of news.php.
The entries displayed will link back to the original page-views of your news-items e.g. http://www.example.com/news/article-title.html.

If you wish you can make the original "http://www.example.com/news/" address redirect back to the site's homepage "http://www.example.com/" by using the redirect tag in the news.php list-view e.g.-
Code: Select all
<cms:if k_is_home>
   <cms:redirect url=k_site_link />
</cms:if>

Do let me know if this helps.

would it be possible for a modification to be made that produces a "prettier" url for the news items such as "http://www.example.com/news/article-title/"

Making changes to the .htaccess file will not cut it because Couch internally recognizes "http://www.example.com/news/article-title/" as being the 'folder-view' and will get confused.
So the answer, I am sorry, is no.
Lastly, the permissions in my couch folder have defaulted to 705 for folders and 604 for files. With security in mind, are these acceptable permission levels?

For most hosts
Folders - 755
Files - 644
are secure enough permissions.
705 is more stricter, so I think it is perfectly ok.
It took me reading your post to realize I would be better off without an embed tag in my news.php. I replaced it with a redirect tag. As you suggested, I copied my list view file to index.php. I also used mod_rewrite to make index.php go to the domain. Nevertheless, with your assistance I was able to achieve what I wanted so thank you. On another matter, when I visit a non-existent html file such as "http://www.example.com/news/does-not-exist.html", my browser receives a genuine 404 response, but I am sent to a page generated by couch that says "Page not found" instead of my custom 404 page. It is important to note that this only happens with html files, for all other file types I am correctly sent to my custom 404 page. Is there a specific reason why this happens? Can I make couch use my 404 page?
Can I make couch use my 404 page?

Certainly. Please take a look at http://www.couchcms.com/docs/concepts/c ... -page.html where it is discussed in detail.
You have thought of everything, I should have read the documentation more fully before asking. :P Took me ten minutes to realize I had to add the gen_htaccess.php statements for the 404 page as well. By the way, on the maintenance mode page, the logo.php file is linked as follows:
Code: Select all
<img src="logo.php" />

It fails to load obviously because I have no logo.php in my root. Thanks for all your help.
Yes, that is a known glitch.
You might be interested in taking a look at this thread: viewtopic.php?f=4&t=2243&p=3138

It discusses ways of using your own custom 'site offline' page.
6 posts Page 1 of 1