我的网站动态网址类似于“http://localhost/news/daily/2.shtml”,但默认网页为“http://localhost/feed/news.php”我需要通过访问将所有动态网址重定向到同一网页。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^news/daily/\w+/\w+/?$ /feed/news.php [L,NC]
</IfModule>
我已将该代码用于动态网址。
答案 0 :(得分:1)
您的正则表达式与/news/daily/2.shtml
不匹配。
您可以使用此规则:
RewriteEngine On
RewriteRule ^news/daily/.+$ /feed/news.php [L,NC]