请帮助我将此功能转换为" 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>
答案 0 :(得分:1)
您不需要RewriteCond
。只需RewriteRule
中的模式即可处理:
RewriteRule ^([^/]+/.+?)\.html$ /$1/ [L,R=301]
RewriteRule ^([^/.]+?)-es(\.html)$ /$1$2 [L,R=301]
RewriteRule ^([^/.]+\.html)$ /$1 [L,R=301]