Created
June 19, 2014 10:10
-
-
Save bocharsky-bw/3dc373b373275846b6de to your computer and use it in GitHub Desktop.
The .htaccess example for Symfony Framework project that deployed on shared hosting.
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
#path/to/project/.htaccess | |
# Rewrite all requests to subdirectory, except exists file requests | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ /web/$1 [QSA,L] | |
</IfModule> |
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
#path/to/project/web/.htaccess | |
# Remove subdirectory and app.php file from request URI | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(app\.php|app_dev\.php|config\.php|web/(?!app_dev\.php|config\.php)) | |
RewriteRule ^(app\.php|app_dev\.php|config\.php)?/?(.*)$ /$2 [R=301,L] | |
</IfModule> |
Work!!!! thank you very much
Going through all those scripts just to deploy symfony on shared hosting is quite a pain. I would recommend hosting PHP based apps, like symfony on a cloud server using PaaS, like Cloudways. This PHP MySQL web hosting platform lets users automatically setup server in one click. Once the server is ready, user can install Symfony using composer and deploy app from github.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not working for me.. URL not found error