.htaccess如何使用RedirectMatch
由于我改变了网站的结构,一些链接被破坏了。 我应该在 .htaccess 中编写什么规则来解决该问题。
以前是这样的
/news/194-kozyrnyj-vecher-premier-ligi.html
现在看起来像这样
/news/2-news/194-kozyrnyj-vecher-premier-ligi.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
RewriteCond %{REQUEST_URI} !^/news/2-news/(.*)
RewriteRule ^news/(.*)$ /news/2-news/$1 [R=permanent,L]
Since I changed the structure of my website, some of the links became broken.
What rule should I write in .htaccess to fix the problem.
before it was like this
/news/194-kozyrnyj-vecher-premier-ligi.html
and now it looks like this
/news/2-news/194-kozyrnyj-vecher-premier-ligi.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
RewriteCond %{REQUEST_URI} !^/news/2-news/(.*)
RewriteRule ^news/(.*)$ /news/2-news/$1 [R=permanent,L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该是:
在你的 .htaccess 文件中
should be:
in your .htaccess file