cotonti.com : I need help with mod_rewrite https://www.cotonti.com Son konu mesajları Cotonti en Sun, 11 Jan 2026 22:33:58 -0000 Twiebie Awesome!

]]>
Cum, 03 Oca 2014 21:44:06 -0000
aro747 Changed to 'Handy' from urltrans.dat and it works perfectly.  Thank you so much!  Really appreciate your help.

]]>
Cum, 03 Oca 2014 21:29:47 -0000
Twiebie Did you remove your own ./datas/urltrans.dat file that you created earlier? It's not needed if you are using the handy preset.

Don't forget to clear the cache in the administration panel after you made any changes.

]]>
Cum, 03 Oca 2014 21:23:03 -0000
aro747 Thanks, that helped a lot.  Almost there.

Now I'm getting:

/profiles/biopharma/?al=Gilead-Sciences

I would like to make it:

/profiles/biopharma/Gilead-Sciences

 

]]>
Cum, 03 Oca 2014 21:09:44 -0000
Twiebie The rules should be applied to your main .htaccess file, which should be in the root of your site.

Follow these instructions and you should be good to go:

http://www.cotonti.com/docs/admin/sef_urls#ch1

]]>
Cum, 03 Oca 2014 10:42:49 -0000
aro747 I have completed this by createing the .htaccess and urltrans.dat file in the /datas directory.  Is that correct?

Does the URL Editor plugin need to be running for this to work and what setting for it?  

Right now its like nothing has happened.  All the old urls are working, nothing has changed.  

This is what I have in my site:

/index.php?e=page&c=biopharma&al=Gilead-Sciences

I would like to change it to this:

/profiles/biopharma/Gilead-Sciences

Thanks for your help.

]]>
Cum, 03 Oca 2014 07:55:32 -0000
aiwass http://www.megamind.se/index.php looks like it's missing a few things....

.htaccess
RewriteEngine On
RewriteBase /

RewriteRule (datas|images|js|skins|plugins|system)/(.*)$ $1/$2 [L]
RewriteCond %{REQUEST_URI} !=cdn-icons/megamind-icon.png
RewriteRule ^admin$	                             admin.php [NC,NE,QSA,L]
RewriteRule ^admin/([a-z]+)$	                 admin.php?m=$1 [NC,NE,QSA,L]
RewriteRule ^login$                              users.php?m=auth [NC,NE,QSA,L]
RewriteRule ^logout/(.*)$                        users.php?m=logout&x=$1 [NC,NE,QSA,L]
RewriteRule ^users$                              users.php [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)$               users.php?gm=$1 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)$           users.php?g=$1 [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)/sort:([a-z]+)-(asc|desc)$   users.php?gm=$1&s=$2&w=$3 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)/sort:([a-z]+)-(asc|desc)$   users.php?g=$1&s=$2&w=$3 [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)/filter:(.*)$   users.php?gm=$1&f=$2 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)/filter:(.*)$   users.php?g=$1&f=$2 [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)/filter:(.*)/sort:([a-z]+)-(asc|desc)$   users.php?gm=$1&f=$2&s=$3&w=$4 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)/filter:(.*)/sort:([a-z]+)-(asc|desc)$   users.php?g=$1&f=$2&s=$3&w=$4 [NC,NE,QSA,L]
RewriteRule ^users/sort:([a-z]+)-(asc|desc)$     users.php?s=$1&w=$2 [NC,NE,QSA,L]
RewriteRule ^users/filter:(.*)$                  users.php?f=$1 [NC,NE,QSA,L]
RewriteRule ^users/filter:(.*)/sort:([a-z]+)-(asc|desc)$   users.php?s=$1&w=$2 [NC,NE,QSA,L]
RewriteRule ^user/(.*)$                          users.php?m=details&u=$1 [NC,NE,QSA,L]
RewriteRule ^user/edit/([0-9]+)$                 users.php?m=edit&id=$1 [NC,NE,QSA,L]
RewriteRule ^profile$                            users.php?m=details [NC,NE,QSA,L]
RewriteRule ^profile/edit$                       users.php?m=profile [NC,NE,QSA,L]
RewriteRule ^message/([0-9]+)$		message.php?msg=$1 [NC,NE,QSA,L]
RewriteRule ^message/([0-9]+)/(.*)$	message.php?msg=$1&redirect=$2 [NC,NE,QSA,L]

RewriteRule ^([0-9]+)$				             page.php?id=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([0-9]+)$             page.php?id=$2 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-]+)$                       page.php?al=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([a-z0-9-]+)$         page.php?al=$2 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-]+)/$                      list.php?c=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([a-z0-9-]+)/$        list.php?c=$2 [NC,NE,QSA,L]

urltrans.dat
list	c=*	{list_url_structure()}
page	*	{page_url_structure()}
message	msg=*&redirect=*	message/{$msg}/{$redirect}
message	msg=*	message/{$msg}
admin	m=*	admin/{$m}
admin	*	admin
users	m=details&id=*&u=*	user/{$u}{!$id}
users	m=details&u=*	user/{$u}
users	m=edit&id=*	user/edit/{$id}
users	m=details	profile
users	m=profile	profile/edit
users	g=*&f=all&s=*&w=*	users/maingroup:{$g}/sort:{$s}-{$w}
users	g=*&f=*&s=*&w=*	users/maingroup:{$g}/filter:{$f}/sort:{$s}-{$w}
users	gm=*&f=all&s=*&w=*	users/group:{$gm}/sort:{$s}-{$w}
users	gm=*&f=*&s=*&w=*	users/group:{$gm}/filter:{$f}/sort:{$s}-{$w}
users	f=all&s=*&w=*	users/sort:{$s}-{$w}
users	f=*&s=*&w=*	users/filter:{$f}/sort:{$s}-{$w}
users	f=*	users/filter:{$f}
users	gm=*	users/group:{$gm}
users	g=*	users/maingroup:{$g}
users	m=register&a=add	register/add
users	m=register	register
users	m=logout&x=*	logout/{$x}
users	m=auth&a=check	login/check
users	m=auth	login
users	*	users
pm	*	pm
rss	*	rss
*	*	{$_area}.php

functions.custom.php
defined('SED_CODE') or die('Wrong URL');
function list_url_structure(&$args, &$spec)
{
    global $sed_cat;
    $url = str_replace('.', '/', $sed_cat[$args['c']]['path']).'/';
    unset($args['c']);
    return $url;
}
function page_url_structure(&$args, &$spec)
{
    global $sed_cat, $pag, $row, $rpagecat;

    $page_cat = (!empty($sed_cat[$rpagecat]['path']) && empty($page_cat)) ? $sed_cat[$rpagecat]['path'] : $page_cat;
    $page_cat = (!empty($sed_cat[$pag['page_cat']]['path']) && empty($page_cat)) ? $sed_cat[$pag['page_cat']]['path'] : $page_cat;
    $page_cat = (!empty($sed_cat[$row['page_cat']]['path']) && empty($page_cat)) ? $sed_cat[$row['page_cat']]['path'] : $page_cat;
    $url = str_replace('.', '/', $page_cat).'/';
    if($args['id'])
    {
        $url .= $args['id'];
        unset($args['id']);
    }
    else
    {
        $url .= urlencode($args['al']);
        unset($args['al']);
    }
    return $url;
}

Added 3 days later:

Update!

The mod_rewrite now works, but with these rules and Rewrites, not the ones mentioned before in the thread:

urltrans
plug	e=contactus	contactus
rss	c=*	{$_area}/{$c}
list	c=*	{$_area}/{$c}
page	al=*	{$c}/{$al}
*	*	{$_area}.php

htaccess
RewriteEngine on
RewriteBase /
RewriteRule (datas|images|pics|cdn-icons|flyers|js|skins|plugins|system)/(.*)$ $1/$2 [L]
RewriteCond %{REQUEST_URI} !=cdn-icons/megamind-icon.png

RewriteRule ^rss/([^/&?#]+)(.*)$ rss.php?c=$1$2 [QSA,NC,NE,L]
RewriteRule ^contactus(.*)$ plug.php?e=contactus$1 [QSA,NC,NE,L]
RewriteRule ^list/([^/&?#]+)(.*)$ list.php?c=$1$2 [QSA,NC,NE,L]
RewriteRule ^([^/&?#]+)/([^/&?#]+)(.*)$ page.php?c=$1&al=$2$3 [QSA,NC,NE,L]
RewriteRule ^([^/&?#]+)/([^/&?#]+)(.*)$ page.php?c=$1&al=$2$3 [QSA,NC,NE,L]

functions.custom
<?php
defined('SED_CODE') or die('Wrong URL');

function page_url_structure(&$args, &$spec)
{
	global $sed_cat, $pag, $row, $rpagecat;

	$page_cat = (!empty($sed_cat[$rpagecat]['path']) && empty($page_cat)) ? $sed_cat[$rpagecat]['path'] : $page_cat;
	$page_cat = (!empty($sed_cat[$pag['page_cat']]['path']) && empty($page_cat)) ? $sed_cat[$pag['page_cat']]['path'] : $page_cat;
	$page_cat = (!empty($sed_cat[$row['page_cat']]['path']) && empty($page_cat)) ? $sed_cat[$row['page_cat']]['path'] : $page_cat;
	$url =  str_replace('.', '/', $page_cat).'/';
	if($args['id'])
	{
		$url .= $args['id'];
		unset($args['id']);
	}
	else
	{
		$url .= urlencode($args['al']);
		unset($args['al']);
	}
	return $url;
}
function list_url_structure(&$args, &$spec)
{
	global $sed_cat;

	$url = str_replace('.', '/', $sed_cat[$args['c']]['path']).'/';
	unset($args['c']);

	return $url;
}

?>
]]>
Çrş, 19 Oca 2011 19:03:16 -0000
GHengeveld
As for .htaccess, that looks good too. Just make sure you have this in there as well:

Options FollowSymLinks -Indexes -MultiViews
DirectoryIndex index.php

RewriteEngine On
RewriteBase /

RewriteRule ^(datas|images|js|lib|modules|plugins|themes)/(.*)$ $1/$2 [L]

Make sure that the rules for page/list are at the bottom in the .htaccess. Also, don't remove the other rules for admin,users etc, because otherwise those pages will become inaccessible. Add these rules for messages to work:

RewriteRule ^message/([0-9]+)$		message.php?msg=$1 [NC,NE,QSA,L]
RewriteRule ^message/([0-9]+)/(.*)$	message.php?msg=$1&redirect=$2 [NC,NE,QSA,L]

You can download my htaccess and urltrans here.]]>
Çrş, 19 Oca 2011 18:53:34 -0000
aiwass
Here is an example:
I want to look in the list called "debate" and I type in www.megamind.se/news/debate and I'm transported to www.megamind.se/message/950 which is a blank page. If I instead write www.megamind.se/debate I go to the same place as before www.megamind.se/message/950. So my guess is that it has to do with these rules, with in the URLtrans.dat and .htaccess :

URLtrans.dat
list	c=*	{list_url_structure()}
page	*	{page_url_structure()}

.htaccess
RewriteRule ^([0-9]+)$				 page.php?id=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([0-9]+)$             page.php?id=$2 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-]+)$                       page.php?al=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([a-z0-9-]+)$         page.php?al=$2 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-]+)/$                      list.php?c=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([a-z0-9-]+)/$        list.php?c=$2 [NC,NE,QSA,L]
]]>
Çrş, 19 Oca 2011 18:40:46 -0000
GHengeveld Remember that you have to modify the Menu entries in the adminpanel to contain your new URLs.]]> Çrş, 19 Oca 2011 18:31:11 -0000 aiwass
The only parts that work with the URL rewrite is megamind.se/admin/ and megamind.se/profile/ and nothing else, like pages and lists.

In the functions.custom.php there is reference to cot_cat but that should be sed_cat.]]>
Çrş, 19 Oca 2011 18:07:51 -0000
GHengeveld 2. In my above example, replace page.php?c= with list.php?c= (it's a Siena thing), for both .htaccess and urltrans.dat.
3. Try emptying your site cache (admin -> other -> internal cache).]]>
Çrş, 19 Oca 2011 17:55:09 -0000
aiwass What I've noticed is that error messages are URL rewritten into http://www.megamind.se/message/950 but nothing else is working as it should. I'm reverting back to alias so that my visitors can enjoy the site while the problem is solved. I've tried both Trustmasters way and your way, but it just won't work. Annoying and rather strange, since I believe you guys know what you are doing, I don't :)

Now my site just displays the header, but without any CSS cosmetics and the source looks like this and it's HTML5:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Megamind Magazine</title>
<meta charset="UTF-8">
<meta name="description" content="Megamind Magazine - A online magazine focusing on DJ Culture and Clubbing in and around the Nordic part of Europe." />
<meta name="keywords" content="Megamind, Megamind Magazine" />
<meta name="robots" content="index,follow">
<meta name="Language" content="en">
<meta name="netinsert" content="0.0.1.4.2.9.1">
<meta name="blogcatalog" content="9BC8730366">
<meta name="alexaVerifyID" content="YMfQhwBI40KNTYIzIWPsepWPZAE">
<link rel="stylesheet" href=https://www.cotonti.com/"http://www.megamind.se/skins/2009/2009.css">
<link rel="alternate" type="application/rss+xml" title="RSS" href=https://www.cotonti.com/"rss.php?c=news">
<link rel="alternate" type="application/rss+xml" title="Sitemap File XML" href=https://www.cotonti.com/"sitemap.xml">
<link rel="canonical" href=https://www.cotonti.com/"http://www.megamind.se">

<script src=https://www.cotonti.com/"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript" src=https://www.cotonti.com/"js/base.js"></script>
<base href=https://www.cotonti.com/"http://www.megamind.se/" />
<!-- TradeDoubler site verification 3084 -->
</head>
<body id="top">
<div id="network">
<div class="center-wrapper">
<header>
<div class="left"><a href=https://www.cotonti.com/"index.php" title="Megamind Magazine">Megamind Magazine</a> <span class="text-separator">|</span> <span class="quiet">Life is a Vacation</span></div>
<div class="right">

<ul class="tabbed" id="network-tabs">
<li><a href=https://www.cotonti.com/"http://twitter.com/#search?q=%23megamind" title="#megamind on Twitter">#megamind</a></li>
<li><a href=https://www.cotonti.com/"http://twitter.com/megaminds/megartists" title="@megaminds/megartists on Twitter">@megaminds/megartists</a></li>
<li><a href=https://www.cotonti.com/"http://www.facebook.com/megamindmagazine" title="Megamind Magazine Fan Page on Facebook">Facebook Fan Page</a></li>
</ul>
<div class="clearer">&nbsp;</div>
</div>
</header>
<div class="clearer">&nbsp;</div>
</div>
</div>
<div id="site">
<div class="center-wrapper">
<div id="header">

<div class="right" id="toolbar"><a href=https://www.cotonti.com/"plug.php?e=twitti&amp;a=signin"><img src="plugins/twitti/img/signin.png" alt="Sign in with Twitter" width="150" height="22"></a></div>
<div class="clearer">&nbsp;</div>
<div id="site-title"><a href=https://www.cotonti.com/"index.php" title="Home"><img src=https://www.cotonti.com/"cdn-icons/megamind-magazine-new-logo.png" width="322" height="81" alt="This is the new Megamind Magazine logo"></a></div>
<nav>
<div id="navboard">
<div class="nbcolumn left" id="nbcolumn-1">
<div class="nbcolumn-content">
<div class="nbcolumn-title"><a href=https://www.cotonti.com/"page.php?id=2939" title="The Articles">The Articles</a></div>
<ul class="plain-list">
<li><a href=https://www.cotonti.com/"list.php?c=debate" title="Debate">Debate</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=newsflash" title="Newsflash">Newsflash</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=globalnews" title="International News">International News</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=labelnews" title="Label News">Label News</a></li>

<li><a href=https://www.cotonti.com/"list.php?c=reviews" title="Chronicles &amp; Reviews">Chronicles &amp; Reviews</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=interviews" title="Interviews">Interviews</a></li>
</ul>
</div>
</div>
<div class="nbcolumn left" id="nbcolumn-2">
<div class="nbcolumn-content">
<div class="nbcolumn-title"><a href=https://www.cotonti.com/"page.php?id=2938" title="The Playlists">The Playlists</a></div>
<ul class="plain-list">
<li><a href=https://www.cotonti.com/"list.php?c=djcharts" title="DJ Charts">DJ Charts</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=spotify" title="Spotify Playlists">Spotify Playlists</a></li>

<li><a href=https://www.cotonti.com/"list.php?c=housepacific" title="Housepacific Playlists">Housepacific Playlists</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=mixes" title="Mixes & Podcasts">Mixes & Podcasts</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=trackoftheday" title="Track of the day">Track of the day</a></li>
</ul>
</div>
</div>
<div class="nbcolumn left" id="nbcolumn-3">
<div class="nbcolumn-content">
<div class="nbcolumn-title"><a href=https://www.cotonti.com/"page.php?id=2936" title="The Industry">The Industry</a></div>
<ul class="plain-list">
<li><a href=https://www.cotonti.com/"list.php?c=biographies" title="Artist Biographies">Artist Biographies</a></li>

<li><a href=https://www.cotonti.com/"list.php?c=lyrics" title="EDM Lyrics">EDM Lyrics</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=competition" title="Competitions">Competitions</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=mpndj" title="Most Popular Nordic DJ">Most Popular Nordic DJ</a></li>
<li><a href=https://www.cotonti.com/"list.php?c=top100" title="DJ Mag Top 100 DJs">DJ Mag Top 100 DJs</a></li>
</ul>
</div>
</div>
<div class="nbcolumn left normargin" id="nbcolumn-4">
<div class="nbcolumn-content">
<div class="nbcolumn-title"><a href=https://www.cotonti.com/"page.php?id=2937" title="The Site">The Site</a></div>
<ul class="plain-list">
<li><a href=https://www.cotonti.com/"list.php?c=sitenews" title="Site News">Site News</a></li>

<li><a href=https://www.cotonti.com/"page.php?id=1" title="About Megamind Magazine">About Megamind Magazine</a></li>
<li><a href=https://www.cotonti.com/"plug.php?e=contactus" title="Contact Us">Contact Us</a></li>
<li><a href=https://www.cotonti.com/"page.php?id=1707" title="Shop">Shop</a></li>
<li><a href=https://www.cotonti.com/"plug.php?e=search&amp;tab=pag" title="Regular Search">Regular Search</a></li>
<li><a href=https://www.cotonti.com/"plug.php?e=tags&amp;a=pages" title="Tag Cloud Search">Tag Cloud Search</a></li>
</ul>
</div>
</div>
<div class="nbcolumn right nolmargin" id="nbcolumn-5">
<div class="nbcolumn-content">
<div class="nbcolumn-title"><a href=https://www.cotonti.com/"page.php?id=1330" title="The Members">The Members</a></div><ul class="plain-list">

<li><a href=https://www.cotonti.com/"users.php?m=auth" title="Login">Login</a></li>
<li><a href=https://www.cotonti.com/"users.php?m=register" title="Become a member">Become a member</a></li>
<li><a href=https://www.cotonti.com/"plug.php?e=passrecover" title="Lost your password?">Lost your password?</a></li>
</ul></div>
</div>
<div class="clearer">&nbsp;</div>
</div>
</nav>
</div>
]]>
Çrş, 19 Oca 2011 17:25:11 -0000
GHengeveld
RewriteRule ^(.*?).html$ page.php?id=$1
In this rule, the value for (.*?) on the left is placed in place of $1 on the right (much like variables in PHP). The problem with this is that you can only use numbers, since you're giving the ID of the page. Therefore this rule will only work correctly for URLs like 1.html, 2.html etc. If you want to have URLs that look nice, by using the page title in the URL, you'll have to use the alternative method that Cotonti provides for calling a page, namely by using the 'al' query parameter instead of 'id'. This results in the following rule:
RewriteRule ^(.*?).html$ page.php?al=$1
This will allow you to call pages by their alias instead of their ID. In your case you don't have aliases, which makes that this doesn't work. Thats why you need aliases. Fortunately the autoalias2 plugin can automatically generate those, even for already existing pages. I suggest you follow Trustmaster's guidelines to make them look nicer. So, first you update the plugin with the new replacement code, then you run the UPDATE query to remove all existing aliases. Finally you run the plugin again so aliases are re-created for all of your pages.

The rewriting system in Cotonti consists of two parts: the Rewrite Rules in .htaccess, and the URL Transformation Rules in datas/urltrans.dat.

The Rewrite Rules allow your pages to be accessed through better looking URLs. This is not really related to Cotonti since it's just normal Apache server behavior (provided by the mod_rewrite Apache module).

The URL Transformation Rules are used by Cotonti's cot_url() function to make it output URLs that match the Rewrite Rules. This is needed because the Rewrite Rules only add aliases for URLs. So long as you don't update your site to actually use these aliases, nobody will know they exist (including Google). Cotonti uses the cot_url() function throughout. Basically this function gets a raw (old) URL, but split into separate parts for filename, query parameters (?a=b&c=d) and hash tag (#abc). It then loops through all the rules in urltrans.dat and looks for a match between those parts and any of the URL Transformation Rules. If it finds one, it will map the URL with the rule, basically doing the reverse of what a Rewrite Rule does. In the end all URLs in Cotonti will have a different format, determined by the transformation rules. Google will index these URLs. Of course, every URL Transformation Rule should have a matching Rewrite Rule. You see they work in pairs, one being the inverse of the other.

By the way, I recommend editing your datas/urltrans.dat directly using a text editor. It's less confusing than the admin tool and makes it easier to edit it in parallel to the .htaccess file.

Added 2 hours 2 minutes later:

Ok, here's a start.

urltrans.dat:
page	c=*	{list_url_structure()}
page	*	{page_url_structure()}
message	msg=*&redirect=*	message/{$msg}/{$redirect}
message	msg=*	message/{$msg}
admin	m=*	admin/{$m}
admin	*	admin
users	m=details&id=*&u=*	user/{$u}{!$id}
users	m=details&u=*	user/{$u}
users	m=edit&id=*	user/edit/{$id}
users	m=details	profile
users	m=profile	profile/edit
users	g=*&f=all&s=*&w=*	users/maingroup:{$g}/sort:{$s}-{$w}
users	g=*&f=*&s=*&w=*	users/maingroup:{$g}/filter:{$f}/sort:{$s}-{$w}
users	gm=*&f=all&s=*&w=*	users/group:{$gm}/sort:{$s}-{$w}
users	gm=*&f=*&s=*&w=*	users/group:{$gm}/filter:{$f}/sort:{$s}-{$w}
users	f=all&s=*&w=*	users/sort:{$s}-{$w}
users	f=*&s=*&w=*	users/filter:{$f}/sort:{$s}-{$w}
users	f=*	users/filter:{$f}
users	gm=*	users/group:{$gm}
users	g=*	users/maingroup:{$g}
users	m=register&a=add	register/add
users	m=register	register
users	m=logout&x=*	logout/{$x}
users	m=auth&a=check	login/check
users	m=auth	login
users	*	users
pm	*	pm
rss	*	rss
*	*	{$_area}.php

.htaccess:
RewriteRule ^admin$	                             admin.php [NC,NE,QSA,L]
RewriteRule ^admin/([a-z]+)$	                 admin.php?m=$1 [NC,NE,QSA,L]
RewriteRule ^login$                              users.php?m=auth [NC,NE,QSA,L]
RewriteRule ^logout/(.*)$                        users.php?m=logout&x=$1 [NC,NE,QSA,L]
RewriteRule ^users$                              users.php [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)$               users.php?gm=$1 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)$           users.php?g=$1 [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)/sort:([a-z]+)-(asc|desc)$   users.php?gm=$1&s=$2&w=$3 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)/sort:([a-z]+)-(asc|desc)$   users.php?g=$1&s=$2&w=$3 [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)/filter:(.*)$   users.php?gm=$1&f=$2 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)/filter:(.*)$   users.php?g=$1&f=$2 [NC,NE,QSA,L]
RewriteRule ^users/group:([0-9]+)/filter:(.*)/sort:([a-z]+)-(asc|desc)$   users.php?gm=$1&f=$2&s=$3&w=$4 [NC,NE,QSA,L]
RewriteRule ^users/maingroup:([0-9]+)/filter:(.*)/sort:([a-z]+)-(asc|desc)$   users.php?g=$1&f=$2&s=$3&w=$4 [NC,NE,QSA,L]
RewriteRule ^users/sort:([a-z]+)-(asc|desc)$     users.php?s=$1&w=$2 [NC,NE,QSA,L]
RewriteRule ^users/filter:(.*)$                  users.php?f=$1 [NC,NE,QSA,L]
RewriteRule ^users/filter:(.*)/sort:([a-z]+)-(asc|desc)$   users.php?s=$1&w=$2 [NC,NE,QSA,L]
RewriteRule ^user/(.*)$                          users.php?m=details&u=$1 [NC,NE,QSA,L]
RewriteRule ^user/edit/([0-9]+)$                 users.php?m=edit&id=$1 [NC,NE,QSA,L]
RewriteRule ^profile$                            users.php?m=details [NC,NE,QSA,L]
RewriteRule ^profile/edit$                       users.php?m=profile [NC,NE,QSA,L]

RewriteRule ^([0-9]+)$				 page.php?id=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([0-9]+)$             page.php?id=$2 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-]+)$                       page.php?al=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([a-z0-9-]+)$         page.php?al=$2 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-]+)/$                      page.php?c=$1 [NC,NE,QSA,L]
RewriteRule ^([a-z0-9-/]+)/([a-z0-9-]+)/$        page.php?c=$2 [NC,NE,QSA,L]

Custom functions:
function list_url_structure(&$args, &$spec)
{
    global $cot_cat;
    $url = str_replace('.', '/', $cot_cat[$args['c']]['path']).'/';
    unset($args['c']);
    return $url;
}
function page_url_structure(&$args, &$spec)
{
    global $cot_cat, $pag, $row, $rpagecat;
 
    $page_cat = (!empty($cot_cat[$rpagecat]['path']) && empty($page_cat)) ? $cot_cat[$rpagecat]['path'] : $page_cat;
    $page_cat = (!empty($cot_cat[$pag['page_cat']]['path']) && empty($page_cat)) ? $cot_cat[$pag['page_cat']]['path'] : $page_cat;
    $page_cat = (!empty($cot_cat[$row['page_cat']]['path']) && empty($page_cat)) ? $cot_cat[$row['page_cat']]['path'] : $page_cat;
    $url = str_replace('.', '/', $page_cat).'/';
    if($args['id'])
    {
        $url .= $args['id'];
        unset($args['id']);
    }
    else
    {
        $url .= urlencode($args['al']);
        unset($args['al']);
    }
    return $url;
}
]]>
Çrş, 19 Oca 2011 05:52:16 -0000
Trustmaster
list	c=*	/{$c}/
page	*	{page_url_structure()}
*	*	{$_area}.php
Page URLs would need a function, since they don't have category names in their parameters. Create a file system/functions.custom.php and add a function to make page urls:
function page_url_structure(&$args)
{
	global $sed_cat, $pag, $row, $rpagecat, $c, $newpagecat;


	$page_cat = (!empty($sed_cat[$rpagecat]['path']) && empty($page_cat)) ? $sed_cat[$rpagecat]['path'] : $page_cat;
	$page_cat = (!empty($sed_cat[$pag['page_cat']]['path']) && empty($page_cat)) ? $sed_cat[$pag['page_cat']]['path'] : $page_cat;
	$page_cat = (!empty($sed_cat[$row['page_cat']]['path']) && empty($page_cat)) ? $sed_cat[$row['page_cat']]['path'] : $page_cat;
	//$page_cat = (!empty($sed_cat[$args['c']]['path']) && empty($page_cat)) ? $sed_cat[$args['c']]['path'] : $page_cat;
	$page_cat = (!empty($sed_cat[$newpagecat]['path']) && empty($page_cat)) ? $sed_cat[$newpagecat]['path'] : $page_cat;

	if (empty($page_cat)) $page_cat = 'articles';
	if($args['id'])
	{
		$url = $page_cat.'/';
		$url .= $args['id'] . '/';
		unset($args['id']);
	}
	elseif($args['al'])
	{
		$url = $page_cat.'/';
		$url .= urlencode($args['al']) . '/';
		unset($args['al']);
	}
	return $url;
}

And finally add mod_rewrite rules to your .htaccess:
# Rewrite engine options
Options FollowSymLinks -Indexes
RewriteEngine On
# Path to Cotonti
RewriteBase /

# Protect static paths
RewriteRule (datas|images|js|skins|plugins|system)/(.*)$ $1/$2 [L]

# Pages by ID
RewriteRule ([a-z]+)/([0-9]+)/ page.php?id=$2 [QSA,NC,NE,L]
# Pages by alias
RewriteRule ([a-z]+)/([a-zA-Z0-9\-_]+)/ page.php?al=$2 [QSA,NC,NE,L]
# Category
RewriteRule ([a-z]+)/ list.php?c=$1 [QSA,NC,NE,L]
]]>
Çrş, 19 Oca 2011 05:25:21 -0000
aiwass The URLS now are longer then before with just ID. I really need a URL rewrite in order to get this working better, cause Aliases are not really what I'm looking for, as stated above.]]> Çrş, 19 Oca 2011 04:38:44 -0000 Trustmaster plugins/autoalias2/inc/autoalias2.functions.php at line 31 and replace
$title = str_replace(' ', $cfg['plugin']['autoalias2']['sep'], $title);
with
$title = preg_replace('#\s+#', $cfg['plugin']['autoalias2']['sep'], $title);
and then try to reassign aliases to those pages (using Admin => Tools => AutoAlias2). Before that you might need to reset your aliases with an SQL query:
UPDATE sed_pages SET page_alias = '';
or edit problematic aliases manually.]]>
Çrş, 19 Oca 2011 04:30:42 -0000
aiwass So basically I have to set aliases for roughly 6000 pages in order to get mod_rewrite happening on my website?

I should have gone for Wordpress back in 2002, then this problem wouldn't have existed. FUCK!

So, 5155 pages now have aliases, but it ain't pretty!
Ex: http://www.megamind.se/page.php?al=track-of-the-day---18th-january-2011]]>
Çrş, 19 Oca 2011 03:30:14 -0000
GHengeveld Çrş, 19 Oca 2011 03:25:54 -0000 aiwass My idea (if feasible) is to the following structure/paths:
www.megamind.se/debate/
www.megamind.se/labelnews/
www.megamind.se/djcharts/
according to the list in my initial post above etc. etc.

And pages within those above stated categories (this might be the hardest one):
www.megamind.se/debate/a-vote-is-everything-in-a-poll/ => www.megamind.se/page.php?id=4861
www.megamind.se/labelnews/shifted-presents-drained/ => www.megamind.se/page.php?id=5509
www.megamind.se/djcharts/alexi-delano-january-chart/ => www.megamind.se/page.php?id=5485
according to the list in my initial post above etc. etc.

OR

www.megamind.se/debate/4861/ => www.megamind.se/page.php?id=4861
www.megamind.se/labelnews/5509/ => www.megamind.se/page.php?id=5509
www.megamind.se/djcharts/5485/ => www.megamind.se/page.php?id=5485
according to the list in my initial post above etc. etc.

FORUMS
I'm going to delete the forums from the site, since no one is using them, they are only available for members anyway.

Is it doable?]]>
Çrş, 19 Oca 2011 03:20:24 -0000
GHengeveld Try a google search for mod_rewrite and you'll know what we mean.]]> Çrş, 19 Oca 2011 03:16:18 -0000 Kingsley

isn't this kinda what the page aliases plug-in does?]]>
Çrş, 19 Oca 2011 03:09:29 -0000
GHengeveld
- Do you want to use 'subfolders', so the path to a file in the CMS is also the path in the URL? This complicates things a lot but looks much better.
- Do you have other site areas to rewrite, such as forums?
- File extension (.html seems to be best for SEO, but no extension at all looks better)

I think it's a good idea to develop a SEO-friendly and cross-site implementation here, so we can put it in documentation, or even provide it with Cotonti by default.

Here's an example:
/path/to/somefolder => list.php?c=somefolder
/somefolder => list.php?c=somefolder
/path/to/somepage.html => page.php?al=somepage
/somepage.html => page.php?al=somepage
/path/to/someID.html => page.php?id=someID
/someID.html => page.php?id=someID
/forums/somesection/sometopictitle.html => forums.php?m=posts&q=sometopicID
/path/to/somefolder.rss => rss.php?c=somefolder
]]>
Çrş, 19 Oca 2011 01:40:41 -0000
aiwass
My site structure (category names)
news
- sitenews
- housepacific
- writeup
- bio
- lyrics
- interviews
- top100
- mpndj
- wtop
- comp
- newsflash
- megamind
- trackoftheday
- spotify
- dj-charts
- mixes
- debate
- global-news
- releases

festivalguides
- festivals2009
-- nordic09
-- eu09
- festivals2008
-- nordic08
-- eu08
- festivals2007
-- nordic07
-- eu07
- festivals2006
-- nordic06
-- eu06
- festivals2005
-- nordic05
-- eu05

Anyone want to help? I badly need it done and I would be thankful for all and any help making it a reality.]]>
Sal, 18 Oca 2011 22:37:43 -0000