Forums / Cotonti / Support / url mod_rewrite page_add bug

question about page_add bug solving with mod_rewrite enabled

donP
#23427 2010-03-07 23:19
I was able to modify function.custom.php like this:
function list_url_structure(&$args)
{
	global $sed_cat;
	
	$url = str_replace('.', '/', $sed_cat[$args['c']]['path']).'/';
	unset($args['c']);
	
	$subdomain = substr($url, 0, strpos($url,"/"));
	$restofurl = substr($url, strpos($url,"/")+1);
	return "http://".$subdomain.".sangelo.net/".$restofurl;
}
so it returns cat.domain.net/subcat...

Now I would find anyone to help me modifying .htacces from
# Level 3
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/([a-z\-]+)/([0-9]+)\.html page.php?id=$4 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/([a-z\-]+)/add$ page.php?m=add&c=$3 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/([a-z\-]+)/([a-zA-Z0-9\-_]+)\.html page.php?al=$4 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/([a-z\-]+)/ list.php?c=$3 [QSA,NC,NE,L]

# Level 2
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/([0-9]+)\.html page.php?id=$3 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/add$ page.php?m=add&c=$2 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/([a-zA-Z0-9\-_]+)\.html page.php?al=$3 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-z\-]+)/ list.php?c=$2 [QSA,NC,NE,L]

# Level1
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([0-9]+)\.html page.php?id=$2 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/add$ page.php?m=add&c=$1 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/([a-zA-Z0-9\-_]+)\.html page.php?al=$2 [QSA,NC,NE,L]
RewriteRule ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari)/ list.php?c=$1 [QSA,NC,NE,L]

to the new rules to reflect my modifications in function.custom.php and give funcionality to my "subdomains rewrite"...

Added 23 hours 47 minutes later:

I was good in redirecting to http://cat1.sangelo.net with this rule:

RewriteCond %{HTTP_HOST} ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari).sangelo.net [NC]
RewriteRule (.*) list.php?c=%1 [L] 

but I'm not able to create second and third level of folder (e.g. htt://cat1.sangelo.net/subcat1/ and http://cat1.sangelo.net/subcat1/subsubcat1/ ) cause, using such a rule:

RewriteCond %{HTTP_HOST} ^(Parrocchia|Oratorio|SocietaSportiva|Scout|RnB|links|ECOComunita|news|Diari).sangelo.net/([a-z\-]+)/ [NC]
RewriteRule (.*) list.php?c=%2 [L] 

I obtain a 404 not found error, cause, as I can see from error log, that rewrite rule causes a
File does not exist: /home/sangelon/public_html/subcat, referer: http://cat1.sangelo.net/
:(

Added 20 hours 44 minutes later:

Nobody can help me here... I think I must search on the web for an Apache mod_rewrite expert...
in [color=#729FCF][b]BLUES[/b][/color] I trust
This post was edited by donP (2010-03-10 21:59, 14 years ago)