<Files "config.php">
	Order Allow,Deny
	Deny from All
</Files>

<Files "common.php">
	Order Allow,Deny
	Deny from All
</Files>

RewriteEngine on

##
# URL's should end in ([^/]+)?
# The last section is used for additional information in the URL (sid, style, action, etc)
# It is handled internally, so you do not need to pass it to anything.
##

#download
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^download/([^/]+)$									./download/file.php [NC]
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^view-install/modx/([^/]+)$							./download/modx/$1 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^view-install/([^/]+)$								./download/view_install.php [NC]

#manage
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^manage?/([^/]+)?/?([^/]+)?$						./manage/index.php?page=$1 [NC]

#authors
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^authors?/([^/]+)/?([^/]+)?/?([^/]+)?$				./authors/index.php?u=$1&page=$2 [NC]

#display all contribs
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^contributions/all/?([^/]+)?$						./index.php?action=contributions [NC]

#display support topics
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^support/(all|mod|style|converter|official_tool|bridge|translation|contributions?)/?([^/]+)?$								./index.php?action=support&type=$1 [NC]

#contributions
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^(mod|style|converter|official_tool|bridge|translation|contributions?)/(create)/?([^/]+)?$						./contributions/index.php?page=$2&type=$1 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^(mod|style|converter|official_tool|bridge|translation|contributions?)/([^/]+)/?([^/]+)?/?([^/]+)?$			./contributions/index.php?c=$2&page=$3&type=$1 [NC]

#search/faq/cron
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^(search|faq|cron)/?([^/]+)?$						./$1.php [NC]

#find-contribution
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^(find\-contribution)/?([^/]+)?$					./search.php?mode=find-contribution [NC]

#rating/login/logout
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^(rate|login|logout)/?([^/]+)?$						./index.php?action=$1 [NC]

#misc index stuff
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^index/([^/]+)/([^/]+)?$							./index.php?action=$1 [NC]

#ajax
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^ajax/([^/]+)?$										./ajax.php [NC]

#categories
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^([^/]+)/([^/]+)/([^/]+)-([0-9]+)/?([^/]+)?$		./index.php?c=$4 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^([^/]+)/([^/]+)-([0-9]+)/?([^/]+)?$				./index.php?c=$3 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^([^/]+)-([0-9]+)/?([^/]+)?$						./index.php?c=$2 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^([^/]+)?$											./index.php [NC]