0

私は既に Typo3 Flow .htaccess を持っています # # TYPO3 Flow コンテキスト設定 #

# You can specify a default context by activating this option:
# SetEnv FLOW_CONTEXT Production

# If the root path is not the parent of the Web directory,
# TYPO3 Flow's root path must be specified manually:
# SetEnv FLOW_ROOTPATH /var/www/myapp/

#
# mod_rewrite configuration
#
<IfModule mod_rewrite.c>

# Enable URL rewriting
RewriteEngine On

# Set flag so we know URL rewriting is available
SetEnv FLOW_REWRITEURLS 1

# You will have to change the path in the following option if you
# experience problems while your installation is located in a subdirectory
# of the website root.
RewriteBase /



# Stop rewrite processing no matter if a package resource, robots.txt etc. exists or not
RewriteRule ^(_Resources/Packages/|robots\.txt|favicon\.ico) - [L]

# Stop rewrite process if the path points to a static file anyway
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]

# Perform rewriting of persistent private resources
RewriteRule ^(_Resources/Persistent/[a-zA-Z0-9]+/(.+/)?[a-f0-9]{40})/.+(\..+) $1$3 [L]

# Perform rewriting of persistent resource files
RewriteRule ^(_Resources/Persistent/.{40})/.+(\..+) $1$2 [L]

# Make sure that not existing resources don't execute TYPO3 Flow
RewriteRule ^_Resources/.* - [L]

# Continue only if the file/symlink/directory does not exist
RewriteRule (.*) index.php

</IfModule>

<IfModule mod_negotiation.c>

# prevents Apache's automatic file negotiation, it breaks resource URLs
Options -MultiViews

</IfModule>

<IfModule mod_setenvif.c>

# Redirect authorization header when PHP is running as CGI
SetEnvIfNoCase Authorization "Basic ([a-zA-Z0-9\+/=]+)" REMOTE_AUTHORIZATION=$0

</IfModule>

ErrorDocument 500 "<h1>Application Error</h1><p>The TYPO3 Flow application could not be launched.</p>"

なので、これがhtaccessの標準的な流れだと思います。独自のルールを定義する可能性はありますか?

私のhtaccessスキルはかなり悪いです。何を編集する必要がありますか GET パラメータを置き換えますか

show?path=

私のドメインは http://domain.com/show?path=/test/test2のようになります

http://domain.com/show/test/test2のようになり ます

よろしくお願いします

4

1 に答える 1

0

はい、.htaccess を拡張できます。mod_proxy が有効になっている場合は、この行を追加するだけで十分です ( [P] フラグの動作を確認してください) 。

# Add this line
RewriteRule ^show/(.*)$ /show?path=/$1 [P]

# Continue only if the file/symlink/directory does not exist
RewriteRule (.*) index.php

ただし、ルーティングを使用してこの種のものを処理する必要があります。そうすると、URI ビルダーと書き換えがフレームワークによって処理されます。

あなたpathがshowActionの単なる文字列引数である場合、10個の追加My/Package/Configuration/Routes.yaml(およびConfiguration/Routes.yamlFlowサブルートの上のメインのサブルートの設定)

-
  name: 'show'
  uriPattern: 'show/{path}'
  defaults:
    '@package':    'My.Package'
    '@controller': 'Standard'
    '@action':     'show'
    '@format':     'html'
  appendExceedingArguments: true

オブジェクトのプロパティである場合は、上記のリンクに例があります。

唯一の問題は/、引数内 ('/test/test2' など) が上記のルートでは機能しないことです。含まれている引数を処理するには、独自のRoute Part Handler/を作成する必要がある場合があります。

于 2016-04-22T08:56:31.877 に答える