Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.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
Regex 通过htaccess更改url_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Regex 通过htaccess更改url

Regex 通过htaccess更改url,regex,apache,.htaccess,mod-rewrite,Regex,Apache,.htaccess,Mod Rewrite,我在htaccess文件中有以下代码。我想通过站点重定向到另一个url。实例http://abc.com/index.php 到http://abc.com/beta/index.php 如何重定向它 谢谢尝试将以下规则添加到块的底部: RewriteCond %{REQUEST_URI} !^beta RewriteRule ^(.*)$ /beta/$1 [L] 您只需要这样一条规则: RewriteRule (?!^beta(/.*|)$)^.*$ beta%{REQUEST_URI}

我在htaccess文件中有以下代码。我想通过站点重定向到另一个url。实例http://abc.com/index.php 到http://abc.com/beta/index.php

如何重定向它


谢谢

尝试将以下规则添加到块的底部:

RewriteCond %{REQUEST_URI} !^beta
RewriteRule ^(.*)$ /beta/$1 [L]

您只需要这样一条规则:

RewriteRule (?!^beta(/.*|)$)^.*$ beta%{REQUEST_URI} [R,L,NC]

这是工作的家伙,但我想显示的文件夹名称在url中的例如。为此,你只需要一个R标志。我已经相应地编辑了我的答案,请检查。
RewriteRule (?!^beta(/.*|)$)^.*$ beta%{REQUEST_URI} [R,L,NC]