Run SILEX website on shared hosting

Asked

Viewed 80 times

1

Staff have developed a website using Silex Micro Framework for a client and need to host it on Ocaweb with a shared hosting. Silex as well as Laravel and other frameworks index.php is not in the site root but in the Public folder. In this hosting I have no way to change the root folder of the site. How would I redirect to the index in the public folder? Thank you

  • Maybe that page of the documentation can help.

  • @Qmechanic73 I did as explained and it didn’t work. See if I did it correctly. (http://pastebin.com/JDAGtd2f)

1 answer

0

Hello! Well, if my comment helps anyone.

See, it is possible to have an application with the index in webroot, according to the documentation. In the documentation it is also exemplified how to redirect to another path outside the webroot, if you like. "If your site is not at the webroot level you will have to uncomment the Rewritebase statement and Adjust the path to point to your directory, relative from the webroot." So for those who still have doubts, you can find out at: http://silex.sensiolabs.org/doc/master/web_servers.html

I will leave here a configuration that can help: An example for an app with the files in the 'web' folder and the Silex core in webroot '\':

/public_html/.htaccess:

<IfModule mod_rewrite.c> 
     RewriteEngine On 
     RewriteRule ^$ /web/ [L] 
     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteCond %{REQUEST_FILENAME} !-d 
     RewriteCond %{REQUEST_URI} !^/web/ 
     RewriteRule ^(.*)$ /web/$1 
     RewriteCond %{SCRIPT_FILENAME} -d 
     RewriteRule ^website.com/(.*[^/])$ http://www.website.com/$1/ [R=301] 
</IfModule>

/public_html/web: 

<IfModule mod_rewrite.c>
     Options -MultiViews 

     RewriteEngine On 
     #RewriteBase / 
     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteRule ^ index.php [QSA,L] 
</IfModule>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.