Fetching contributors…
Cannot retrieve contributors at this time
21 lines (17 sloc) 738 Bytes
RewriteEngine on
# Rewrite views
# *************
RewriteCond $1 !^(index\.php|images|view|robots\.txt) [NC]
RewriteCond $2 ^view$ [NC]
# Redirect /view to /view/stable/
RewriteRule ^(.*?)/([^/]*?)/?$ /$1/$2/stable/ [R=301,L]
# Redirect to trailing slash
RewriteRule ^(.*?)/([^/]*?)/((?:[0-9]+(?:\.[0-9]+){1,2})|stable|sleep)$ /$1/$2/$3/ [R=301,L]
# Rewrite index to /view/{version}
RewriteRule ^(.*?)/([^/]*?)/((?:[0-9]+(?:\.[0-9]+){1,2})|stable|sleep)/$ view/$3/index.php?alias=$1 [L]
# Rewrite other files
RewriteRule ^(.*?)/([^/]*?)/((?:[0-9]+(?:\.[0-9]+){1,2})|stable|sleep)/(.*)$ view/$3/$4 [L,QSA]
# Rewrite for API
# ***************
RewriteCond $1 !^(index\.php|images|view|robots\.txt) [NC]
RewriteRule ^(.*)$ index.php/$1 [L]