动态url通过htaccess调用相同的php页面


dynamic url call same php page by htaccess

我的网站动态url是这样的"http://localhost/news/daily/2.shtml"但默认页面为"http://localhost/feed/news.php"我需要通过访问将所有这些动态url重定向到同一页面。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^news/daily/'w+/'w+/?$ /feed/news.php [L,NC]
</IfModule>

我已经把那个代码用于动态url。

您的正则表达式与/news/daily/2.shtml不匹配。

你可以使用这个规则:

RewriteEngine On
RewriteRule ^news/daily/.+$ /feed/news.php [L,NC]