Running Silex on the shared provider

Asked

Viewed 218 times

3

I just uploaded a site to Locaweb on a simple and shared Linux hosting, only it didn’t work for once.

I imagine it is because the index is not in the site root, but inside the folder public. Question: How do I make the index within the public work, since I can’t change the virtualhost configuration?

Thank you Ps. htaccess is so:

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 solve the problem in parts. 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]

This way the site loads but as a consequence the image files, css, js that are all in the public folder are not found.

What can I do?

  • I spoke here of a similar problem in the Laravel. And apparently, the Silex also uses the Symphony. See: http://answall.com/questions/43685/problema-com-subpastas-e-reescrita-de-url-laravel

  • Have you tried RewriteRule ^(.*)$ public/index.php?p=$1?

  • @Wallacemaxters I did try. Only then when I write Silex.dominio.com/admin for example it gives an internal error and the url changes to Silex.dominio.com/admin/? p=admin. Do you have any idea what this might be?

  • Try to level up your directory structure and change the public to the public_html folder.

2 answers

1

Solved. I switched to a plan of Resale ai la I can change the document_root of the site and all right now.

Thank you

0


I was having the same problem, the only difference is that my Assets folder with css, img, javascript and etc, is at the root outside the public/web folder (I don’t know the impact this will have with respect to patterns ...). To test on the localhost I created a virtual host, but already tested on the server and tb worked. To solve the problem of css folder inside the web folder maybe add this line solves :

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

It’s not my solution, I’ve searched so many places and tested so many combinations, and I haven’t kept the source where I found the solution.

My folder structure looks something like this :

  • ROOT
    • Assets
    • src
    • vendor
    • view
    • web

And . htaccess (at the root of the site) was 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>

Browser other questions tagged

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