Htaccess File

prof-milki/freshcode/master/.htaccess

ENV, GET, HTTP_HOST, POST, PUT, QUERY_STRING, REDIRECT_STATUS, REQUEST_METHOD
# encoding: UTF-8
# api: apache
# title: RewriteRules
# description: Map paths onto dispatcher script
# version: 1.0
# depends: mod_rewrite

Options -MultiViews
RewriteEngine On

#-- Simulate [END] flag
RewriteCond  %{ENV:REDIRECT_STATUS}  =200
RewriteRule  ^                  -                       [L,NS]

#-- Strip www. prefix
RewriteCond  %{REQUEST_METHOD}  ^GET$
RewriteCond  %{HTTP_HOST}       ^ww+.(w+.w+).?$
RewriteRule  ^(.*)$             http://%1/$1            [R=301,QSA,L]

#-- RSS/Atom aliases
RewriteCond  %{QUERY_STRING}    ^format=(atom|rss|json)$
RewriteRule  ^$ feed/xfer.%1
RewriteRule  ^(?:projects).(atom|rss|json)$  feed/xfer.$1

#-- Freecode API mapping
RewriteCond  %{REQUEST_METHOD}  ^GET$
RewriteRule  ^projects/([w-_]+).json$  index.php?page=api&name=$1&api=query [L,NS,QSA]
RewriteCond  %{REQUEST_METHOD}  ^PUT$
RewriteRule  ^projects/([w-_]+).json$  index.php?page=api&name=$1&api=update_core [L,NS,QSA]
RewriteCond  %{REQUEST_METHOD}  ^POST$
RewriteRule  ^projects/([w-_]+)/releases.json$  index.php?page=api&name=$1&api=publish [L,NS,QSA]
RewriteCond  %{REQUEST_METHOD}  ^(GET|DELETE)$
RewriteRule  ^projects/([w-_]+)/releases/(w+).json$  index.php?page=api&name=$1&api=version_%1&id=$2 [L,NS,QSA]
RewriteCond  %{REQUEST_METHOD}  ^(GET|PUT|POST|PUSH)$
RewriteRule  ^projects/([w-_]+)/urls.json$  index.php?page=api&name=$1&api=urls [L,NS,QSA] 

#-- Page dispatching
RewriteRule  ^index/?$    /      [R=301,L]
RewriteRule  ^$                 index.php?page=index    [L,NS,QSA]
RewriteRule  ^(projects|submit|search|flag|names?|tags?|feed|login|links|rc|admin|github-releases|drchangelog)b/?(w+(?:[-_]w+)*(?:.w{2,7})?)?(?:.(json|atom|rss))?/?$   index.php?page=$1&name=$2&ext=$3   [L,NS,QSA]
RewriteRule  ^(forum|meta)b/?(w+)?/?$   page_forum.php?name=$2   [L,NS,QSA]

#-- Deny direct invocations
RewriteRule  ^freshcode.db.*$  -                       [F]
RewriteRule  ^.                -                       [F]
RewriteCond  %{ENV:REDIRECT_STATUS}  !200
RewriteRule  ^w+.php(|/.*)$   -                       [F,L,NS]

#-- invalid resources
RewriteRule ^favicon.(png|ico|jpeg)$ http://freshcode.club/img/changes.png [R=301,L]
Exit mobile version