简体   繁体   English

如何在htaccess中将RedirectMatch转换为RewriteCond

[英]How to transform RedirectMatch to RewriteCond in htaccess

Could you help me please to transform this functions to "rewritecond" format? 您能帮我将此功能转换为“ rewritecond”格式吗? I need to change from this format: 我需要更改此格式:

RedirectMatch 301 ^/folder_A/([^/]+/.+?)\\.html$ /$1/

RedirectMatch 301 ^/folder_A/([^/.]+\\.html)$ /$1

To something like this: 对于这样的事情:

RewriteCond %{REQUEST_URI} XXXXX RewriteRule XXXXX [L,R=301] RewriteCond%{REQUEST_URI} XXXXX RewriteRule XXXXX [L,R = 301]

RewriteCond %{REQUEST_URI} XXXXX RewriteRule XXXXX [L,R=301] RewriteCond%{REQUEST_URI} XXXXX RewriteRule XXXXX [L,R = 301]

Here my actual .htaccess file: 这是我实际的.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>

You don't need RewriteCond . 您不需要RewriteCond Just pattern in RewriteRule will be be able to handle this: 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM