Created
February 15, 2013 18:18
-
-
Save gustavo-rodrigues-dev/4962250 to your computer and use it in GitHub Desktop.
Regra que permite usar um pushState nativo no htacces, onde todas as páginas irão redirecionar para index, além de declarar exceções para as pastas de css, js e imgs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
Options +FollowSymLinks | |
# ---------------------------------------------------------------------- | |
# General Rule | |
# ---------------------------------------------------------------------- | |
# Redirect all files and paths to index.html | |
RewriteRule ^index.html(.*)$ - [L,QSA] | |
# ---------------------------------------------------------------------- | |
# Exception to the general rule | |
# ---------------------------------------------------------------------- | |
# Declare path and files where don't apply general rules | |
# js/./../* - not apply general rule redirect of all folders and files to path "/js" | |
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d | |
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | |
RewriteRule js/(.*)$ js/$1 [L,QSA] | |
# img/./../* - not apply general rule redirect of all folders and files to path "/img" | |
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d | |
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | |
RewriteRule img/(.*)$ img/$1 [L,QSA] | |
# css/./../* - not apply general rule redirect of all folders and files to path "/css" | |
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d | |
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | |
RewriteRule css/(.*)$ css/$1 [L,QSA] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i think you can rewrite the exceptions: