[英]How to transform RedirectMatch to RewriteCond in htaccess
您能帮我将此功能转换为“ rewritecond”格式吗? 我需要更改此格式:
RedirectMatch 301 ^/folder_A/([^/]+/.+?)\\.html$ /$1/
RedirectMatch 301 ^/folder_A/([^/.]+\\.html)$ /$1
对于这样的事情:
RewriteCond%{REQUEST_URI} XXXXX RewriteRule XXXXX [L,R = 301]
RewriteCond%{REQUEST_URI} XXXXX RewriteRule XXXXX [L,R = 301]
这是我实际的.htaccess文件:
DirectoryIndex index.html index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^tienda_2011/([^/]+/.+?)\.html$ /store_copia/es/$1/ [L,R=301]
RewriteRule ^tienda_2011/([^/.]+\.html)$ /store_copia/es/$1 [L,R=301]
#RedirectMatch 301 ^/tienda_2011/([^/]+/.+?)\.html$ /store_copia/es/$1/
#RedirectMatch 301 ^/tienda_2011/([^/.]+\.html)$ /store_copia/es/$1
# So "RewriteBase" should be:
# RewriteBase /store/cart
RewriteBase /tienda_2011
RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?sef_rewrite=1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} .*\/catalog\/.*
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteRule . index.php?sef_rewrite=1 [L,QSA]
</IfModule>
您不需要RewriteCond
。 RewriteRule
正义模式将能够处理此问题:
RewriteRule ^([^/]+/.+?)\.html$ /$1/ [L,R=301]
RewriteRule ^([^/.]+?)-es(\.html)$ /$1$2 [L,R=301]
RewriteRule ^([^/.]+\.html)$ /$1 [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.