Skip to content

Instantly share code, notes, and snippets.

@desbest
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desbest/11036be380270a7e6001 to your computer and use it in GitHub Desktop.
Save desbest/11036be380270a7e6001 to your computer and use it in GitHub Desktop.
portfolio htaccess. attempt 2 (breaks my site)
RewriteEngine on
# Some hosts require a rewritebase rule, if so, uncomment the RewriteBase line below. If you are running from a subdirectory, your rewritebase should match the name of the path to where stacey is stored.
# ie. if in a folder named 'stacey', RewriteBase /stacey
# RewriteBase /
#ErrorDocument 404 /404.html
# Rewrite any calls to *.html, *.json, *.xml, *.atom, *.rss, *.rdf or *.txt if a folder matching * exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !public/
RewriteCond %{DOCUMENT_ROOT}/public/$1.$2 !-f
RewriteRule (.+)\.(html|json|xml|atom|rss|rdf|txt)$ $1/ [L]
# Add a trailing slash to directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.)
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ([^/]+)$ $1/ [L]
# Rewrite any calls to /* or /app to the index.php file
RewriteCond %{REQUEST_URI} /app/$
#desbest edit
RewriteCond !%{REQUEST_URI} /projects/clickrobot/$
RewriteRule ^app/ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#desbest edit
RewriteCond !%{REQUEST_URI} /projects/clickrobot/$
RewriteRule ^(.*)/$ index.php?$1 [L]
# Rewrite /projects/* to /content/projects/*
RewriteRule ^(projects/.*)$ /content/$1 [L,NC,R=302]
# Rewrite any file calls to the public directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !public/
#desbest edit
RewriteCond !%{REQUEST_URI} /projects/clickrobot/$
RewriteRule ^(.+)$ public/$1 [L]
## rewrite /*/ to /content/public/work/*
# If the request is not for a valid directory
#RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^((?!content/work/).*) content/work/$1 [L,NC]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment