Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Factorial in Apache rewrite rules
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^just/(1*)/?$ /index.php?just=$1 [L]
RewriteRule ^add-and/(\w+)/1(1*)/(1+)(/.*)$ /$1/$2$3$4
RewriteRule ^add/(1+)/(1+)/?$ /add-and/just/$1/$2/
RewriteRule ^mul-and/(\w+)/(1+)/(1+)(/.*)$ /mul-and-b/$1/1/$2/$3$4
RewriteRule ^mul-and-b/(\w+)/(1+)/1/(1+)(/.*)$ /$1/$2$4
RewriteRule ^mul-and-b/(\w+)/(1+)/1(1+)/1(1*)(/.*)$ /mul-and-b/$1/$2$4/$3/1$4$5
RewriteRule ^mul/(1+)/(1+)/?$ /mul-and/just/$1/$2/
RewriteRule ^fac/(1+)/?$ /fac_b/11/$1
RewriteRule ^fac_b/(1+)/1/?$ /just/$1
RewriteRule ^fac_b/(1+)/1(1+)/?$ /mul-and/fac_b/$1/1$2/$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.