English 中文(简体)
Configuration problem in my production server in symfony
原标题:

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

最佳回答

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.

问题回答

.htaccess mod_rewrite





相关问题
Redirect subdomain to /folder

I want to redirect the sub-domain webmail to /roundcube for that domain. This have to work for all virtual hosts in apache. Example: webmail.example.com must point to [www.]example.com/roundcube ...

Fastest way to store easily editable config data in PHP?

What is the fastest way to store config data in PHP so that it is easily changeable (via PHP)? First I thought about having config.php file, but I can t edit it on fly with PHP, at least not very ...

siFR 3, no fonctionnal issues for some Javascript params

I m trying to use siFR 3. I need set to the flash element to use max width for a text replaced. The width of flash text can use 200px MAX. The problem of the following code is that Here s is my ...

Getting a Reference to a Zend_Application s Config Object

Is there a helper method/object/methodology for getting a reference to a Zend_Application s config resource? I know I can do something like $config = new Zend_Config_Ini($file, $environment); but ...

Where to configure Hudson node disk/temp space thresholds?

I am currently running a Hudson instance on a VM slice. As I don t have a need to run more than a couple small applications from it, I m minimizing how much space I devote to it. The sizes I ve ...

trigger config transformation in TFS 2010 or msbuild

I m attempting to make use of configuration transformations in a continuous integration environment. I need a way to tell the TFS build agent to perform the transformations. I was kind of hoping it ...

wix custom dialog for config edit

hi i m trying make a setup msi for my application with wix v3 I have a problem about this task; I need a user input that will be stored in my application s config file (for example i need a dialog for ...

热门标签