1

ええと、私は共有ホストを持っています、そして私はsshアクセスを持っていません。問題はサーバー構造とsymfonyestructureです...

サーバーにはこのestructureがあります

エラー/ログ/...web /

そして、WebディレクトリでWebアプリケーションをロードできます...symnfony構造は..

app / .. web /

問題は、私のドメインでアクセスしようとすると、www.domainname.com /web/をsymfonyプロジェクトにアクセスする必要があるということです。

1)すべてのWeb symfonyコンテンツをWebディレクトリにコピーしようとすると、最初のページはok(index.php)になりますが、リンクはwww.domainame.com/moduleName/であり、このディレクトリが存在しないため、リンクが間違っています...

2)Webドメインディレクトリに.htaccesファイルを作成した場合... www.domainname.comを配置すると、Web自動にリダイレクトされますが、他のリンクにはwww.domainname.com/web/moduleName/があります。

www.domainname.com/moduleName/...だけが欲しいのですがどうすればいいですか?

それは急務であります。

ありがとう。

edit1。これは私の.htaccessファイルです...

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。関連する別の問題

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

これを変更すると、/ blog /ディレクトリへのアクセスに問題が発生しますか?ありがとう

4

2 に答える 2

1

.htaccess mod_rewrite

于 2010-01-28T18:03:40.527 に答える
0

URL から /web を削除するには、mod_rewrite という Apache モジュールを使用する必要があります。そのようです:

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>

このドキュメントはこちらです。

ただし、symfony をセットアップする適切な方法は、web フォルダーを指す仮想ホストを使用することです。これにより、Web フォルダーがルートとして使用されるため、URL には表示されません。

于 2010-01-28T18:12:33.977 に答える