Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
基于Apache Httpd.conf条件重定向URL_Apache_Redirect_Url Rewriting_Jboss_Httpd.conf - Fatal编程技术网

基于Apache Httpd.conf条件重定向URL

基于Apache Httpd.conf条件重定向URL,apache,redirect,url-rewriting,jboss,httpd.conf,Apache,Redirect,Url Rewriting,Jboss,Httpd.conf,我正在使用与JBoss集成的Apache web服务器“httpd-2.4.25-win64-VC14”。端口重定向工作正常。现在我想根据一些条件替换URL,比如说,如果URL包含'Mobile',那么我想用'Mobile/web'替换它并转发它 为此,我使用了标签中的标签。现在我发现的大多数在线引用都在标签前面有URL,比如'var/www/example',但是我想基于localhost重定向,因为我在本地运行Jboss 那么我应该如何写标签内容呢,我试着用下面的 <VirtualHo

我正在使用与JBoss集成的Apache web服务器“httpd-2.4.25-win64-VC14”。端口重定向工作正常。现在我想根据一些条件替换URL,比如说,如果URL包含
'Mobile'
,那么我想用
'Mobile/web'
替换它并转发它

为此,我使用了
标签中的
标签。现在我发现的大多数在线引用都在标签前面有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>

通融
重新启动发动机
重写条件%{QUERY_STRING}(管理)
重写规则^Mobile http://%{http_HOST}/Mobile/web=%1[NC,L]
http://localhost:8081/Mobile/register
应替换为
http://localhost:8081/Mobile/web/register

请建议

仅当查询字符串包含单词“manage”时,才需要重定向:

如果要在查询字符串不包含特定单词时重定向,可以使用如下模式:

RewriteCond %{QUERY_STRING} (!manage)
重写规则如下:

 RewriteRule ^Mobile /Mobile/web/register [NC,L,QSA]
QSA在这里可能会有所帮助:

将原始请求URL中的任何查询字符串追加到任何查询 在重写目标中创建的字符串

此解决方案将传递所有查询字符串参数并从重定向到

 RewriteRule ^Mobile /Mobile/web/register [NC,L,QSA]