ComicCMS Forums
NEW VERSION RELEASED!

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

2486 Posts in 607 Topics- by 19856 Members

September 08, 2010, 03:08 AM




ComicCMSComicCMSThinktankPeople Friendly URL's
Pages: [1]
Print
Author Topic: People Friendly URL's  (Read 791 times)
thedustud
New
*
Posts: 5



View Profile WWW
« on: January 29, 2010, 01:49 PM »

Is there a way to add the comic title to the url? Right now each comic is ?id=1, but it would be nice to have a the comic title in there as well. Is that a feature already and I missed it or could you hack something together using the {{title}} code? Thanks!
Logged
SteveH
Administrator
Hero Member
*****
Posts: 763



View Profile
« Reply #1 on: January 29, 2010, 02:11 PM »

The only way ComicCMS recognises comics is by their ID, so the ID has to be in the URL somewhere. This is to do with the super-efficient cache system.

You can always add more stuff into the URL that ComicCMS will just ignore. The easiest thing to do would just be to change the links to:
http:///?id={{comic_id}}&title={{comic_title}}

This isn't perfect though, it is not properly URL encoded so if you have any symbols in your titles it may go a bit iffy. To fix that, edit lib/site/template.php, around line 553, just after a line starting with case 'md5' and before the line starting with // put in:
Code:
case 'urlencode': return urlencode($return); break;
Now you can use:
http:///?id={{comic_id}}&title={{comic_title:urlencode}}
Logged

Sign up to Comic Rank and get to know the number of readers of your webcomic!
lonelyfetus
New
*
Posts: 8


View Profile
« Reply #2 on: April 09, 2010, 12:27 AM »

I think he's talking permalinks. It would be nice to have http://comicsite/id/comictitle/ !
Logged
SteveH
Administrator
Hero Member
*****
Posts: 763



View Profile
« Reply #3 on: April 10, 2010, 06:39 AM »

That can be done in the same way, but with some modifications to your .htaccess file, if your server supports it.

Something along the lines of:
Code:
RewriteEngine on
RewriteRule ^([0-9]+)/([.]+)([\/]?)$ /index.php?id=$1 [L]
Logged

Sign up to Comic Rank and get to know the number of readers of your webcomic!
jamboree
New
*
Posts: 4


View Profile
« Reply #4 on: April 20, 2010, 08:54 PM »

I'm using something similar:

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([0-9]+)$ /$1/ [R]
RewriteRule ^([0-9]+)/$ /index.php?id=$1 [L]
RewriteRule ^(.*)\.html$ /$1.php [L]

I'm new to it, so it took a lot of trial and error.

First line redirects http://url/id to http://url/id/
Second line points http://url/id/ to http://url/index.php?id=id
The last line makes the php files look like they have an html extension.

I got burned out before my last task, which was to have http://url/admin/ return error 404, and have an arbitrary url point to http://url/admin/
Logged
Pages: [1]
Print
Jump to:  

ComicCMS, free php webcomic management software Copyright © 2007 Steve H