Running Silex on the shared provider

3

I just uploaded a site to Locaweb in a simple and shared Linux hosting, but for a change it did not work.

I suppose this is because the index is not in the root of the site, but in the public folder. Question: How do I make the index within public work, since I can not change the virtualhost configuration?

Thank you Ps. htaccess looks like this:

RewriteEngine on
#AddHandler php53-script .php .php5 .php53 .pht .phtm .phtml
#suPHP_ConfigPath /home/site1389376316/
AddHandler php55-script .php
DirectoryIndex public/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?p=$1 [QSA]

I was able to sort out the problem. I made a small change in htaccess.

I removed this line:

DirectoryIndex public/index.php

And I changed this:

RewriteRule ^(.*)$ public/index.php?p=$1 [QSA]

In this way the site loads but consequently the image files, css, js that are all in the public folder are not found.

What can I do?

    
asked by anonymous 24.02.2015 / 23:47

2 answers

0

I was having the same problem, the only difference is that my assets folder with css, img, javascript and etc, is in the root outside the public / web folder (I do not know what impact this will have on patterns.) .). To test on localhost I created a virtual host, but I already tested it on the server and it worked. To solve the css folder problem inside the web folder maybe add this line to resolve:

 RewriteCond %{REQUEST_URI} !^/web/css/

The solution is not mine, I researched so many places and tested so many combinations, and I did not save the source from where I found the solution.

My folder structure looks something like this:

  • ROOT
    • assets
    • src
    • vendor
    • view
    • web

And the .htaccess (in the root of the site) looks like this:

    DirectoryIndex /web/index.php

< IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/web/
    RewriteRule (.*) /web/?$1

< /IfModule>

< IfModule !mod_rewrite.c>
    < IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the start page to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /web/index.php/
        # RedirectTemp cannot be used instead
    < /IfModule>
< /IfModule>
    
11.05.2016 / 21:55
1

Solved. I moved to a reseller plan so I can change the document_root of the site and everything is fine now.

Thank you

    
26.02.2015 / 19:41