views:

200

answers:

2

Well, i have a shared host and i have'nt ssh access. The problem is the server structure and symfony estructure...

Server has this estructure

error/ log/ ... web/

and in web dir we can load web aplication... symnfony structure is..

app/ .. web/

well the problem is that with my domain, if i try to access i have to put www.domainname.com/web/ to acces at symfony project....

1)if i try to copy all web symfony content to web directory it render first page ok(index.php) but links are wrong because they are www.domainame.com/moduleName/ and this directory does not exist...

2)if i create an .htacces file in web domain dir... when i put www.domainname.com it redirects me to web automatic but the other links have www.domainname.com/web/moduleName/ in his direction

I want ONLY www.domainname.com/moduleName/... how i can do it???

It is urgent.

Thanks.

edit1. this is my .htaccess file...

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ web/index.php [QSA,L]
</IfModule>

edit2. another problem related

..
/web/
   app/
   ...
   web/
/blog/

if i modify this, i will have problems accessing to my /blog/ dir? thanks

+1  A: 

.htaccess mod_rewrite

davidosomething
davidosomething... i have edited my post to show you my .htaccess file.. what i have to modify¿
nebur85
A: 

In order for the /web to be removed from the url you need to use an apache module called mod_rewrite. Like so:

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

The docs for this are here.

The proper way to set up symfony though is to use a Virtual Host which is pointed at the web folder. This will use the web folder as your root and therefore you won't see it in the url.

Peter D
peter it not works well because it redirects me to web server module.. in my .htacces file (i edited post) you can see what works me... but only when i put www.domain.com the other links are... www.domain.com/web/module and i want to delete /web/
nebur85
i try to do...$this->setWebDir($this->getRootDir().'/web');and code you paste but it doesn't work... i have edited my answer.thanks
nebur85
finally i copy the web(symfony) content, to web(server). change projectconfiguration route and it works well with RewriteRule ^(.*)$ index.php [QSA,L]thanks.
nebur85