我正在使用與JBoss集成的Apache Web服務器「httpd-2.4.25-win64-VC14」。端口重定向工作正常。現在我想根據一些條件來替換URL,比如說,如果URL包含'Mobile'
,那麼我想用'Mobile/web'
替換它並轉發它。根據條件Apache Httpd.conf重定向URL
爲此,我在<VirtualHost>
標記中使用了<Directory>
標記。現在,我發現的大多數在線參考文獻都在標記前加上了URL,例如'var/www/example'
,但我想根據localhost
重定向,因爲我在本地運行Jboss。
所以,我應該怎麼寫的標籤內容,我試着用下面的
<VirtualHost *:80>
<Directory /var/www/example/>
Allow From All
RewriteEngine On
RewriteCond %{QUERY_STRING} (manage)
RewriteRule ^Mobile http://%{HTTP_HOST}/Mobile/web=%1 [NC,L]
</Directory>
</VirtualHost>
像http://localhost:8081/Mobile/register
應http://localhost:8081/Mobile/web/register
更換,請推薦