Php htaccess类别到主站点的链接优化
我有htaccess文件,目录链接重定向到主站点 看看下面我的代码Php htaccess类别到主站点的链接优化,php,regex,.htaccess,mod-rewrite,redirect,Php,Regex,.htaccess,Mod Rewrite,Redirect,我有htaccess文件,目录链接重定向到主站点 看看下面我的代码 RewriteCond %{REQUEST_URI} ^/shop/test1(/)?$ RewriteRule (.*) http://example.com/test1 [R=301,L] RewriteCond %{REQUEST_URI} ^/shop/test2(/)?$ RewriteRule (.*) http://example.com/test2 [R=301,L] RewriteCond %{REQUES
RewriteCond %{REQUEST_URI} ^/shop/test1(/)?$
RewriteRule (.*) http://example.com/test1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/shop/test2(/)?$
RewriteRule (.*) http://example.com/test2 [R=301,L]
RewriteCond %{REQUEST_URI} ^/shop/test3(/)?$
RewriteRule (.*) http://example.com/test3 [R=301,L]
优化上述代码的任何其他方法这3条规则可以组合成一条规则:
RewriteEngine On
RewriteRule ^shop/(test1|test2|test3)/?$ http://example.com/$1 [R=301,L,NC]