Htaccess rewriterule不与两个小丑角色合作

时间:2014-12-12 21:36:46

标签: regex .htaccess mod-rewrite url-redirection

RewriteRule ^(.*)data(.*)$ http://regi.krater.hu/$1data$2 [R=301,L]

应该{​​{3}} - > http://krater.hu/xxxxdataxxxx.php 我还是不明白我的错误在哪里?求你帮忙! :)

完整代码:     #BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)data(.*)$ http://regi.krater.hu/$1data$2 [R=301,L]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

1 个答案:

答案 0 :(得分:1)

在您的示例中,您似乎在QUERY_STRING中输入data而不是URI。请改用此规则:

RewriteCond %{THE_REQUEST} \s/+(.*?)data(\S*)\s [NC]
RewriteRule ^ http://regi.krater.hu/%1data%2 [R=302,L,NE]