我怎样才能有一个使用htaccess的正则表达式的模式,它将重定向所有传入链接
从example.com/test-en/到example.com/test/
如果根域名后面的字符串包含后缀-en,如果匹配重定向,则应该过滤掉。
这是我想要做的空洞代码
RewriteCond %{HTTP_HOST} http://www.example.co.uk [NC]
**RewriteRule ^tag/(.*)-en/$ http://www.example.co.uk/$1 [L,R=301]**
RewriteRule ^\d{4}/\d{2}/\d{2}/(.*)$ http://www.example.co.uk/$1 [L,R=301]
RewriteRule ^\d{4}/\d{2}/(.*)$ http://www.example.co.uk/$1 [L,R=301]发布于 2012-09-13 18:45:54
这应该做到这一点:
RewriteRule /?test-[a-zA-Z]{2}/ /test/发布于 2012-09-13 18:49:16
试试这个:
RewriteRule ^(.*)-en/?$ /$1/ [L]发布于 2012-09-14 00:39:04
你有一条规则:
RewriteRule ^tag/(.*)-en/$ http://www.example.co.uk/$1 [L,R=301]但是你要求重定向,而不是在前面加上/tag。(对于不同的域),但如果您希望保留标记,则需要在目标中添加以下内容:
RewriteRule ^tag/(.*)-en/$ http://www.example.co.uk/tag/$1 [L,R=301]否则,这条规则对我来说完全没问题。
https://stackoverflow.com/questions/12404481
复制相似问题