Regex 重写一些不以斜杠结尾的URL,并以一些特定的单词开头

Regex 重写一些不以斜杠结尾的URL,并以一些特定的单词开头,regex,apache,rewrite,Regex,Apache,Rewrite,实际上,我是用PHP实现的,但我想在Apache级别(.htaccess)实现这一点 我想在URL上做一个301重定向,该URL以:noticias | analises |气象学| artigos | videos开头,而不是以斜杠或.html结尾 我想重定向到带有斜杠的页面 在这些情况下重定向: /noticias --> /noticias/ /noticias/soja --> /noticias/soja /noticias/soja/pag-2 --> /noti

实际上,我是用PHP实现的,但我想在Apache级别(.htaccess)实现这一点

我想在URL上做一个301重定向,该URL以:noticias | analises |气象学| artigos | videos开头,而不是以斜杠或.html结尾

我想重定向到带有斜杠的页面

在这些情况下重定向:

/noticias  --> /noticias/
/noticias/soja --> /noticias/soja
/noticias/soja/pag-2 --> /noticias/soja/pag-2/
但在这种情况下并非如此:

/noticias/soja/1105-soja-opera-em-alta.html

有人能帮我吗?

请把这个放到目录的
.htaccess
文件中:

# noticias/
RewriteEngine on
RewriteRule ^index.php$ http://www.example.com/noticias/ [r=301,nc]
或用于第二个目录:

# noticias/soja/
RewriteEngine on
RewriteRule ^index.php$ http://www.example.com/noticias/soja/ [r=301,nc]
# noticias/soja/pag-2/
RewriteEngine on
RewriteRule ^index.php$ http://www.example.com/noticias/soja/pag-2/ [r=301,nc]
对于第三个目录:

# noticias/soja/
RewriteEngine on
RewriteRule ^index.php$ http://www.example.com/noticias/soja/ [r=301,nc]
# noticias/soja/pag-2/
RewriteEngine on
RewriteRule ^index.php$ http://www.example.com/noticias/soja/pag-2/ [r=301,nc]
谢谢你,亚当,但是“/noticias”或“/noticias/soja”已经是一个重写规则了,我只想在末尾强制一个斜杠。比如:
RewriteCond%{REQUEST_URI}^/\b(noticeias | analises | atriotia | artigos | videos | educational)*?$RewriteRule^(.*)$http://%{http_HOST}/$1/[R=301,L]
但是在这种情况下,这不会验证它是否已经以斜杠或.html结尾