Created
October 29, 2016 22:04
-
-
Save marcosfreitas/037b7d706cd89bbc4b8b9370807378fa to your computer and use it in GitHub Desktop.
rewrite folder "web/" inside silex
This file contains hidden or 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
# Project'a Structure | |
# localhost/projects/myProject/ | |
# -- .htacess | |
# | -- RewriteEngine On | |
# | -- RewriteBase /projects/myProject/ | |
# | -- DirectoryIndex web/index.php | |
# -- src/ | |
# ----- App/ | |
# -- web/ | |
# ----- .htaccess (this file) | |
# ----- assets/ | |
# ----- index.php (starting silex) | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# because of the assets files | |
RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png)$ [NC] | |
# Rewriting the base | |
RewriteRule ^/?$ web/index.php | |
# "web/" is the public directory inside this project | |
# Redirect to address without "web/" | |
RewriteCond %{REQUEST_URI} /web/([^\s?]*) [NC] | |
RewriteRule ^ %1 [L,NE,R=302] | |
# Rewrite pointing to "web/(...)" | |
#RewriteRule ^(.*)$ $1 [QSA,L] | |
DirectoryIndex index.php index.html index.htm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment