Regex 通过htaccess更改url
我在htaccess文件中有以下代码。我想通过站点重定向到另一个url。实例http://abc.com/index.php 到http://abc.com/beta/index.php 如何重定向它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}
谢谢尝试将以下规则添加到块的底部:
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]