Форуми / Cotonti / Extensions / [RELEASE] Cotonti Awesome mod_rewrite URL System

<<<1234

fade2k
#46 09.07.2009 13:28
I just wanted to note that when using this on a primary domain (account) with hostgator will require you to also have .htaccess files in all add-on domain folders otherwise it wouldn't allow me to see the sites (gave error).

Here is one that got my other sites to work on hostgator (in the event someone needs it):

RewriteEngine on
RewriteBase /

# Protect .htaccess and .htpasswd files
<FilesMatch "^\.ht">
  Order allow,deny
  Deny from all
</FilesMatch>

# Protect config.* files
<FilesMatch "^config(\..*)?$">
  Order deny,allow
  Deny from all
</FilesMatch>

# Protect files depending on extension
<FilesMatch "^(.*)\.(inc|inc\.php|tpl|tpl\.php|sql|txt|dat|csv|exe|dll)$">
  Order deny,allow
  Deny from all
</FilesMatch>

# Disable directory browsing
Options -Indexes
- Be Kind, Please Rewind -
Spuner
#47 09.07.2009 15:40
I use this on the main domain. But don't work.

This is a page with the errors.
revolution_371.rar
In what there can be an error? Maybe it's my error somewhere?
Kilandor
#48 10.07.2009 03:07
I've finally written up a detailed guide for re-writing URL's you may find it here

http://www.cotonti.com/docs/en/admin/url_modification
tensh
#49 10.07.2009 17:48
Hmm, as for me, sometimes the strange error appears from the level of my browser:

"The site cannot be displayed because it uses invalid type of compression."

It happens when I set up advanced url display. I wonder if it can happen due to php accelerators or other types of php cache.

Also, try to login, when using urltrans for username: it also converts user/auth, and so user cannot log in.

See also my comments in your article (and delete them after making use of them)

Edit:

I made a custom function for parsing only users urls:

In fuctions.custom.php:
function users_url_structure(&$args, &$spec)
{
	if ($args['m'] == 'details') 
	{

	$url =  'users/details/'.$args['u'];
	unset($args['u']); 
	unset($args['m']); 
	unset($args['id']); 
	}
	else 
	{ 
	$url = $spec['_area'].'.php'; 
	}

	return $url;
}

In urltrans.dat:

users	*	{users_url_structure()}

In .htaccess:
RewriteRule ^users/([^/&?#]+)/([^/&?#]+)(.*)$ users.php?m=$1&u=$2$3 [QSA,NC,NE,L]

I have no idea if it's coded right (I'm not that experienced in coding), but it works :P

My simple solution for plugins:

In functions.custom.php:

function plug_url_structure(&$args, &$spec)
{
	$url =  'site/'.$args['e'].'.html';
	unset($args['e']);
	
	return $url;
}

In urltrans:
plug	*	{plug_url_structure()}

In htaccess:

RewriteRule ^site/([^/&?#]+)\.html(.*)$ plug.php?e=$1$2 [QSA,NC,NE,L]

I use "site" prefix because all other areas "name.php" are rewritten with "name.html".

Відредаговано: tensh (10.07.2009 22:15, 14 років тому)
Spuner
#50 12.07.2009 05:48
I use the rules for pages wroten in article by Kilandor. Thanks him for that. :-)
But the news plugin conflict with it. Now it have out links as site.com/(page id or alias) and it's give the 404 error, because need to site.com/(page cat(here it's "news"))/(page id or alias)
How it can be fixed?
tensh
#51 13.07.2009 14:55
Either write a separate function for news or just edit the news template in:
skins/yourskin/plugins/news.tpl
and place the {PAGE_ROW_CAT} tag in the news url ^^
So that it looks: <a href="{PAGE_ROW_CAT}{PAGE_ROW_URL}">
previously: <a href="{PAGE_ROW_URL}">

Hi again;

Ever tried to add a page in the frontend having the advanced url settings as described in article? It redirects me to www.mysite.com//pageid (page not found because no category is in the url)- hmm, what can be wrong?

Do you experience something similar? Hmmm. It's quite irritating. :) The pages are added normally but the after-add redirect is screwed.

Added 120 days later:

Somebody solved the problem described by me?
I still can't get the answer.

Відредаговано: tensh (12.11.2009 18:19, 14 років тому)
donP
#52 18.01.2010 22:51
URL-Rewrite solution at beginning of this post (http://www.cotonti.com/forums.php?m=posts&id=10670) makes pagination links in forum not working anymore! X-(

Added 9 days later:

Noone here to answer? :(

Added 32 days later:

This post isn't so visited unfortunately :(
In addiction I can't apply subdomains method cause my server redirected the request to Service Provider Courtesy Page :( What's wrong?
in [color=#729FCF][b]BLUES[/b][/color] I trust

Відредаговано: donP (02.03.2010 08:22, 14 років тому)
young mone
#53 02.03.2010 10:28
umm i get this
Not Found

The requested URL /forum/test-t14.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
[url=<a href="">http://pspw.co.cc]All</a> your game needs and more[/url]
MUST!
#54 03.04.2010 06:03
singh336
#55 17.05.2011 04:32

this mod is giving me a couple errors in firefox, 930 error and also when reloading or going back to home page after the error firefox says the page is in a redirection loop

 

this should be made an official mod/plugin included with cotonti from the packaged releases because its a very poweful mod to have. I had it so close to working.. just the htaccess , there is so much in there i had no idea where to begin to debug... oh well

 

 

 

<a href="http://www.streetlegalmods.com/">http://www.streetlegalmods.com/</a>
Evil
#56 27.05.2011 06:00
kaossik
#57 19.06.2011 12:19

Hello,

I have succeed to make Lombi's patern work partially at link http://smph.kommet.cz 

First I had to add some special signs into functions.custom.php since there are more of them in our language.

Then yet it works very good for forums only.

all forums like /forums.php?m=topics&s=2 transformed to /forum/volne_povidani-s2.html

this list /list.php?c=news transformed to /news/

but all other lists like /list.php?c=articles failed to do anything

all pages like /page.php?id=170 failed to do anything

 

tensh
#58 22.08.2012 17:54

I have a question: would the forum rules be still valid in cotonti Siena? I would like forum rewrites very much!
Would it be possible to use Siena's built-in nice urls for the site and additionally nice urls for forums?

<<<1234