2016-04-19 135 views
0

我已經在TYPO3的流量的.htaccess # #TYPO3流內容設置 #htaccess的重寫GET參數

# 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

在此先感謝,認爲

回答

0

是的,你可以擴展.htaccess,如果你有mod_proxy啓用添加這一行應該是足夠的(檢查什麼[P] flag does

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

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

但是,你應該使用Routing來處理這種東西 - 那麼你將有uri構建器和框架重寫處理。

如果您path是的showAction,十隻字符串參數增加My/Package/Configuration/Routes.yaml(及以上的流動子路徑在主Configuration/Routes.yaml設置子路徑)

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

如果它是對象的屬性,你的鏈接有上面的例子。

唯一的問題是,在/參數(如「/測試/測試2」)不會與路線的工作上面。要處理包含/參數,你可能需要創建自己的Route Part Handler