<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : mod_rewrite HELP needed</title>
		<link>https://www.cotonti.com</link>
		<description>Neueste Themenbeiträge</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Thu, 30 Apr 2026 20:32:31 -0000</pubDate>

		<item>
			<title>donP</title>
			<description><![CDATA[I've tried, but, as I'd imagined, nothing works anymore, cause with a positive condition instead of a negative one, it will skip all following Rewriting rules...<br />
The positive one works well, but it seems I can't tell the last rewriterule to capture the right backreference to transform <span style="color:#4E9A06">http:/maincat.sangelo.net/</span> in <span style="color:#4E9A06">list.php?c=maincat</span><br /><br /><b>Added 4 hours 30 minutes later:</b><br /><br /><span style="font-size:16pt"><span style="color:#F57900"><strong>Eureka! I finally found it!</strong></span>  <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/smile.gif" alt=":)" /> </span><br />
<br />
<pre class="code">RewriteCond %{HTTP_HOST} ^www\.sangelo\.net$ &#091;NC&#093;
RewriteRule . - &#091;S=8&#093;
RewriteRule ^(&#091;a-z\-&#093;+)/(&#091;a-z\-&#093;+)/(&#091;0-9&#093;+)\.html$ page.php?id=$3 &#091;NC,QSA,L&#093;
RewriteRule ^(&#091;a-z\-&#093;+)/(&#091;a-z\-&#093;+)/(&#091;a-z0-9_-&#093;+)\.html$ page.php?al=$3 &#091;NC,QSA,L&#093;
RewriteRule ^(&#091;a-z\-&#093;+)/(&#091;0-9&#093;+)\.html$ page.php?id=$2 &#091;NC,QSA,L&#093;
RewriteRule ^(&#091;a-z\-&#093;+)/(&#091;a-z0-9_-&#093;+)\.html$ page.php?al=$2 &#091;NC,QSA,L&#093;
RewriteRule ^(&#091;0-9&#093;+)\.html$ page.php?id=$1 &#091;NC,QSA,L&#093;
RewriteRule ^(&#091;a-z0-9_-&#093;+)\.html$ page.php?al=$1 &#091;NC,QSA,L&#093;
RewriteRule ^(&#091;a-z\-&#093;+)/(&#091;a-z\-&#093;+)/?$ list.php?c=$2 &#091;NC,QSA,L&#093;
RewriteRule ^(&#091;a-z\-&#093;+)/?$ list.php?c=$1 &#091;NC,QSA,L&#093;

RewriteCond %{HTTP_HOST} ^(articles|downloads|news|docs)\.sangelo\.net$ &#091;NC&#093;
RewriteRule ^(&#091;a-z\-&#093;*)$ list.php?c=%1 &#091;QSA,NC,NE,L&#093;</pre>
<br />
<span style="color:#A40000"><strong>Many thanks to Koradhil</strong></span> for his assistence and support! <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/wink.gif" alt=";)" /><br />
And to my patience to try all possible combination and reading millions of pages about Apache mod_rewriting!<br />
<br />
<span style="color:#4E9A06"><strong>P.S.</strong></span> I've added <strong>page.php?id=ID</strong> rule and also modified list rules to match either ending slash form and form without ending slash.<br />
I've also restricted cat and subcat RegEx to lowercase alphabetical characters to speedup Server.]]></description>
			<pubDate>Mo, 22 Mär 2010 02:35:11 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23698]]></link>
		</item>
		<item>
			<title>GHengeveld</title>
			<description><![CDATA[Try:<br />
<pre class="code">RewriteCond %{HTTP_HOST} ^(articles|downloads|news|docs)\.sangelo\.net$ &#091;NC&#093;</pre>]]></description>
			<pubDate>Mo, 22 Mär 2010 01:57:11 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23696]]></link>
		</item>
		<item>
			<title>donP</title>
			<description><![CDATA[Thanks, Koradhil <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/wink.gif" alt=";)" /><br />
Now everything seems to work fine but the<br />
<pre class="code">RewriteRule ^/$ <a href="http://www.example.com/list.php?c=%1" rel="nofollow">http://www.example.com/list.php?c=%1</a> &#091;NC,QSA&#093;</pre>
I think because the <strong>%1</strong> would be <em>a backreference from last matched RewriteCond directive in the current bunch of conditions</em> (as Apache documentation says), and in<br />
<pre class="code">RewriteCond %{HTTP_HOST} !^www\.example\.com &#091;NC&#093;</pre>
there are no backreferences at all..<br />
<br />
I had tried changing RewriteCond with this one:<br />
<pre class="code">RewriteCond %{HTTP_HOST} !^(articles|downloads|news|docs)\.sangelo\.net$ &#091;NC&#093;</pre>
but nothing happens... all levels (pages and lists) works well... but <a href="http://articles.sangelo.net" rel="nofollow">http://articles.sangelo.net</a> or <a href="http://downloads.sangelo.net" rel="nofollow">http://downloads.sangelo.net</a> etc displays me the main page of site (like www.sangelo.net) and they don't guide me to list.php?c=maincat<br />
<br />
It's the<br />
<pre class="code">RewriteRule ^/$ list.php?c=%1 &#091;QSA,NC,NE,L&#093;</pre>
written in right syntax?<br />
<br />
Elsewhere I found<br />
<pre class="code">RewriteRule ^(.*)$ list.php?c=%1 &#091;QSA,NC,NE,L&#093;</pre>
but that one causes me many errors...  <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/confused.gif" alt=":/" />]]></description>
			<pubDate>So, 21 Mär 2010 23:01:05 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23695]]></link>
		</item>
		<item>
			<title>GHengeveld</title>
			<description><![CDATA[donP, you should do your research better. The second line of my code makes the RewriteCond work for the next 7 lines (actually it will skip 7 lines when false, hence the S=7):<br />
<pre class="code">RewriteRule . - &#091;S=7&#093;</pre>
Note that I haven't tested it, so you might be right in saying it doesn't work. I'm just trying to push you in the right direction.<br />
<br />
Update: I checked the <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" rel="nofollow">Apache documentation</a> on this, and I think the RewriteCond needs to change. Try this one:<br />
<pre class="code">RewriteCond %{HTTP_HOST} ^www\.example\.com &#091;NC&#093;</pre>
This is more likely to work since the second line skips 7 lines when the Cond is true (not false). My first suggestion would actually make it skip all rules when a category subdomain was set (while they should be skipped when it is NOT a category subdomain, so www).]]></description>
			<pubDate>So, 21 Mär 2010 01:21:35 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23686]]></link>
		</item>
		<item>
			<title>donP</title>
			<description><![CDATA[<blockquote><a href="https://www.cotonti.com/forums.php?m=posts&amp;p=23679#23679">#</a> <strong>tensh :</strong>
I was talking about a plugin, not custom function.<br />
<span style="color:#A40000">You're quite rude</span>.<br />
<br />
<span style="color:#A40000">You better listen</span> to Koradhil <span style="color:#A40000">and do not ask for rewrite help anymore</span>.<br />
</blockquote>
<br />
Koradhil solution doesn't work at all (also because we can't use only one RewriteCond for many RewriteRule commands...). However, <strong>thanks to Koradhil for his always generous and kind answers</strong>...<br />
<br />
I'm trying (step by step) to find a solution by myself, although I'm not so good with Apache Commands syntax.<br />
<br />
By the way, tensh, I think I'm not so rude (I hope you tell me that only because of a misunderstanding in language interpretation), at least not as much as one man of Support Team telling me no to ask for any help anymore <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/sad.gif" alt=":(" /><br />
<br />
Anyway, I think I'll post here the complete solution when I'll find it, for the benefit of all of those users that would need it but would be afraid of asking some help after your threats.]]></description>
			<pubDate>Sa, 20 Mär 2010 21:19:30 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23681]]></link>
		</item>
		<item>
			<title>GHengeveld</title>
			<description><![CDATA[Simplest solution is to allow any subdomain and any subfolder (subcat) to be set when calling a page, regardless of whether or not that page resides in that category. You can control that with the Cotonti rewrite.<br />
<br />
<pre class="code">RewriteCond %{HTTP_HOST} !^www\.example\.com &#091;NC&#093;
RewriteRule . - &#091;S=7&#093;
RewriteRule ^/$ <a href="http://www.example.com/list.php?c=%1" rel="nofollow">http://www.example.com/list.php?c=%1</a> &#091;NC,QSA&#093;
RewriteRule ^(&#091;a-z0-9_-&#093;+)/$ <a href="http://www.example.com/list.php?c=$1" rel="nofollow">http://www.example.com/list.php?c=$1</a> &#091;NC,QSA&#093;
RewriteRule ^(&#091;a-z0-9_-&#093;+)/(&#091;a-z0-9_-&#093;+)/$ <a href="http://www.example.com/list.php?c=$2" rel="nofollow">http://www.example.com/list.php?c=$2</a> &#091;NC,QSA&#093;
RewriteRule ^(&#091;a-z0-9_-&#093;+)/(&#091;a-z0-9_-&#093;+)/(&#091;a-z0-9_-&#093;+)/$ <a href="http://www.example.com/list.php?c=$3" rel="nofollow">http://www.example.com/list.php?c=$3</a> &#091;NC,QSA&#093;
RewriteRule ^(&#091;a-z0-9_-&#093;+)\.html$ <a href="http://www.example.com/page.php?al=$1" rel="nofollow">http://www.example.com/page.php?al=$1</a> &#091;NC,QSA&#093;
RewriteRule ^(&#091;a-z0-9_-&#093;+)/(&#091;a-z0-9_-&#093;+)\.html$ <a href="http://www.example.com/page.php?al=$2" rel="nofollow">http://www.example.com/page.php?al=$2</a> &#091;NC,QSA&#093;
RewriteRule ^(&#091;a-z0-9_-&#093;+)/(&#091;a-z0-9_-&#093;+)/(&#091;a-z0-9_-&#093;+)\.html$ <a href="http://www.example.com/page.php?al=$3" rel="nofollow">http://www.example.com/page.php?al=$3</a> &#091;NC,QSA&#093;</pre>
<br />
This should:<br />
- Rewrite main cat from subdomain to list.php<br />
- Rewrite subcats from subfolder to list.php (up to 3 levels)<br />
- Rewrite .html files to page.php?al= (up to 3 levels)<br />
<br />
Note that I've included the full domain each time, to make sure calls are made to the www subdomain and not the fake (category) subdomain (where your files aren't located). You can leave the domain out if you've set a * CNAME example.com in your DNS records.<br />
Also note that subfolders (categories) have to end with a slash. Page aliases and category codes may only consist of alphanumeric chars, - and _]]></description>
			<pubDate>Fr, 19 Mär 2010 20:39:30 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23670]]></link>
		</item>
		<item>
			<title>donP</title>
			<description><![CDATA[<span style="color:#4E9A06"><strong>It isn't a problem of plugin or custom function</strong></span> (I've already created <strong>system/functions.custom.php</strong>, addressed by <strong>datas/ultrans.dat</strong>, that translate Cotonti urls for my needs).<br />
The problem is only in <em>RewriteCond</em> &amp; <em>RewriteRule</em> syntax.<br />
I'm trying to understand how to tell <span style="color:#5C3566">Apache mod_rewrite module</span> to read the value of last string passed by backreference among the two last dashes, like Trustmaster exaple does (unfortunately, only for the second part of url, after the domain part, 'cause that example uses only <em>RewriteRule</em> and not <em>RewriteCond</em>).<br />
<br />
Indeed, I don't want to pass more values to <em>list.php</em>, but <span style="text-decoration:underline"><strong>to read the right part of rewritten url</strong></span> and then pass it to <em>list.php</em> as <strong>c=<em>structure-code</em></strong> value, got it?<br />
<br />
My goal is to tell the Server:<br />
<br />
<span style="font-size:16pt">Read this string</span> (the one in red):<br />
<span style="font-size:16pt">http://cat.sangelo.net/blablabla/<span style="color:#A40000"><strong>subcat</strong></span>/)</span> (I don't mind what is passed by the other blablabla variables, 'cause I'll write them right with a custom function) <span style="font-size:16pt">and pass it to list.php as c=<span style="color:#A40000"><strong><em>structure-code</em></strong></span></span><br />
<br />
<strong>In other words:</strong><br />
Read this url: <a href="http://sport.sangelo.net/blablabla/" rel="nofollow">http://sport.sangelo.net/blablabla/</a><span style="color:#A40000">basket</span>/ and give me <a href="http://www.sangelo.net/list.php?c=" rel="nofollow">http://www.sangelo.net/list.php?c=</a><span style="color:#A40000">basket</span><br />
<br />
Got it?  <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/wink.gif" alt=";)" /> <br />
<br />
<span style="font-size:14pt"><span style="color:#4E9A06">I'm sure this is possible, only finding the right <em>RewriteCond/RewriteRule</em> syntax.</span></span>]]></description>
			<pubDate>Fr, 19 Mär 2010 17:35:04 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23667]]></link>
		</item>
		<item>
			<title>donP</title>
			<description><![CDATA[I've heard somewhere (between the tons of documentation pages I've read) it's better to escape dots with dashes, but it's the same thing, with or without dashes: first level it's working, but not the second level...  <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/sad.gif" alt=":(" />]]></description>
			<pubDate>Fr, 19 Mär 2010 06:00:13 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23654]]></link>
		</item>
		<item>
			<title>donP</title>
			<description><![CDATA[<blockquote><strong>tensh:</strong><hr />This is <strong>not </strong>what exactly you did. Trustmaster's rewrite rule contains in a bracket the main list directories. Your example doesn't mention any main directories which the server should look for in first place. That's what I meant and that's how I imagine it works. Otherwise there would be no brackets with defined core categories, only the brackets with variable patterns.</blockquote>
<span style="color:#204A87"><strong>Also My rules</strong> contain in a bracket the main list directories. I wrote only a general example not to list here my own categories... otherwise, a general form like that one could be usefull for a continually changing page-structure (a e-commerce website, for example).</span><br />
<br />
<blockquote><strong>tensh:</strong><hr />I suggested that you might toy with definedmaincat.sangelo.net rewrite rules, like:<br />
^(articles|downloads|news|docs).sangelo.net/([A-Za-z0-9\-]+) [blablabla]</blockquote>
<span style="color:#204A87"><strong>That IS</strong> my rewrite rule:</span><br />
<pre class="code">RewriteCond %{HTTP_HOST} ^(articles|downloads|news|docs)\.sangelo\.net/(&#091;a-z\-&#093;+)$ &#091;NC&#093;
RewriteRule (.*) list.php?c=%2 &#091;QSA,NC,NE,L&#093;</pre>
<span style="color:#204A87">but it doesn't work</span>  <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/confused.gif" alt=":/" />]]></description>
			<pubDate>Do, 18 Mär 2010 21:23:48 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23635]]></link>
		</item>
		<item>
			<title>donP</title>
			<description><![CDATA[<blockquote><strong>tensh:</strong><hr />Also, I think that the last example might have a typo... no $ at the end.</blockquote>
<span style="color:#204A87">It's irrilevant, it works well also without $ at the end.</span><br />
<blockquote><strong>tensh:</strong><hr />It's because there's no reflection of the category structure in lists - you have two variables in htaccess rule and only one variable in list.php, <strong>how do you imagine script should act in this case?</strong> </blockquote>
<span style="color:#204A87">I'm only trying to read the last variable in rewrite rule. Other variables could also been filled with casual values (the right strings come from function-custom.php, that I've already written successfully), 'cause the really relevant value to call the appropriate structure-code for <em>list.php?c=catcode</em> is only the last value included between <strong>/</strong> and <strong>/</strong>, with a backreference, as you can see in the rules written by Trustmaster:</span><br />
<pre class="code">### Combined pages &amp; lists ###
# Level 3
RewriteRule ^(articles|downloads|news|docs)/(&#091;a-z\-&#093;+)/(&#091;a-z\-&#093;+)/(&#091;0-9&#093;+) page.php?id=$4 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news)/(&#091;a-z\-&#093;+)/(&#091;a-z\-&#093;+)/add$ page.php?m=add&amp;c=$3 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news|docs)/(&#091;a-z\-&#093;+)/(&#091;a-z\-&#093;+)/(&#091;a-zA-Z0-9\-_&#093;+) page.php?al=$4 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news)/(&#091;a-z\-&#093;+)/(&#091;a-z\-&#093;+)/ list.php?c=$3 &#091;QSA,NC,NE,L&#093;

# Level 2
RewriteRule ^(articles|downloads|news|docs)/(&#091;a-z\-&#093;+)/(&#091;0-9&#093;+) page.php?id=$3 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news)/(&#091;a-z\-&#093;+)/add$ page.php?m=add&amp;c=$2 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news|docs)/(&#091;a-z\-&#093;+)/(&#091;a-zA-Z0-9\-_&#093;+) page.php?al=$3 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news)/(&#091;a-z\-&#093;+)/ list.php?c=$2 &#091;QSA,NC,NE,L&#093;

# Level1
RewriteRule ^(articles|downloads|news|docs)/(&#091;0-9&#093;+) page.php?id=$2 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news|docs)/add$ page.php?m=add&amp;c=$1 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news|docs)/(&#091;a-zA-Z0-9\-_&#093;+) page.php?al=$2 &#091;QSA,NC,NE,L&#093;
RewriteRule ^(articles|downloads|news|docs)/ list.php?c=$1 &#091;QSA,NC,NE,L&#093;</pre>
<br />
<span style="color:#204A87">With that rules, for example, you can write in browser url adress bar:</span><br />
<span style="color:#A40000">www.sangelo.net/cat<strong>1</strong>/subcat<strong>2</strong>/</span> <span style="color:#204A87">and however you'll go to </span><span style="color:#A40000">list.php?c=subcat<strong>2</strong></span><span style="color:#204A87">, cause the rule tells the Server intepreter to read the last backreference and use it to call the appropriate subcategory with <em>list.php?c=subcatcode</em></span><br />
<blockquote><strong>tensh:</strong><hr />See the docs for classic category example, adjust it to reflect subdomain.</blockquote>
<span style="color:#204A87">As you can see, this is what I have done (but adding a RewriteCond, cause to change the domain part of url that's the only way).</span>]]></description>
			<pubDate>Do, 18 Mär 2010 17:56:22 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23631]]></link>
		</item>
		<item>
			<title>donP</title>
			<description><![CDATA[I <a href="http://www.cotonti.com/forums.php?m=posts&amp;id=23489">already answered</a> this question but nobody could help me... <span style="color:#4E9A06"><strong>But i think this would be a great enancement for a Cotonti-driven website, giving webmasters the ability to create more structure, using fake subdomains and subfolders, also for SEO...</strong></span><br />
<br />
Now, I need to work with Rewriting Rules in .htaccess to create fake subdomains for the main categories of my page-structure, like this:<br />
<br />
<span style="color:#A40000"><strong>FOR LISTS:</strong></span><br />
<pre class="code">http://www.sangelo.net/list.php?c=cat    ==&gt;    <a href="http://cat.sangelo.net" rel="nofollow">http://cat.sangelo.net</a>
<a href="http://www.sangelo.net/list.php?c=subcat" rel="nofollow">http://www.sangelo.net/list.php?c=subcat</a>    ==&gt;    <a href="http://cat.sangelo.net/subcat/" rel="nofollow">http://cat.sangelo.net/subcat/</a>
<a href="http://www.sangelo.net/list.php?c=subsubcat" rel="nofollow">http://www.sangelo.net/list.php?c=subsubcat</a>    ==&gt;    <a href="http://cat.sangelo.net/subcat/subsubcat/" rel="nofollow">http://cat.sangelo.net/subcat/subsubcat/</a></pre>
<br />
<span style="color:#A40000"><strong>FOR PAGES:</strong></span><br />
<pre class="code">http://www.sangelo.net/page.php?al=ALIAS    ==&gt;    <a href="http://cat.sangelo.net/alias.html" rel="nofollow">http://cat.sangelo.net/alias.html</a>
<a href="http://www.sangelo.net/" rel="nofollow">http://www.sangelo.net/</a> (of a subcat) page.php?al=ALIAS    ==&gt;    <a href="http://cat.sangelo.net/subcat/alias.html" rel="nofollow">http://cat.sangelo.net/subcat/alias.html</a>
<a href="http://www.sangelo.net/" rel="nofollow">http://www.sangelo.net/</a> (of a subsubcat) page.php?al=ALIAS    ==&gt;    <a href="http://cat.sangelo.net/subcat/subsubcat/alias.html" rel="nofollow">http://cat.sangelo.net/subcat/subsubcat/alias.html</a></pre>
<br />
Actually, I'm only albe to do the first rewriting<br />
<pre class="code">http://www.sangelo.net/list.php?c=cat    ==&gt;    <a href="http://cat.sangelo.net" rel="nofollow">http://cat.sangelo.net</a></pre>
using this code:<br />
<pre class="code">RewriteCond %{HTTP_HOST} !www.sangelo.net$ &#091;NC&#093;
RewriteCond %{HTTP_HOST} ^(&#091;A-Za-z0-9\-&#093;+).sangelo.net$ &#091;NC&#093;
RewriteRule (.*) list.php?c=%1 &#091;NE,NC,L,QSA&#093;</pre>
<br />
But when I try to do the second level (adding a subcat like a fake subfolder), with this rule:<br />
<pre class="code">RewriteCond %{HTTP_HOST} ^(&#091;A-Za-z0-9\-&#093;+).sangelo.net/(&#091;A-Za-z0-9\-&#093;+) &#091;NC&#093;
RewriteRule (.*) list.php?c=%2 &#091;NE,NC,L,QSA&#093;</pre>
nothing happens... it still present me the subdomain path (cat.sangelo.net) and its real content (list.php?c=cat)<br />
<br />
Why?<br />
<br />
Anyone can help me?]]></description>
			<pubDate>Mi, 17 Mär 2010 21:39:40 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=5428&d=0#post23618]]></link>
		</item>
	</channel>
</rss>