开发者

How to rewrite folder access to a specific file?

I'm trying to setup the following rule:

RewriteRule ^(?=health-safety/.*)([^/\.]+)/开发者_开发技巧?$ course-list.php?id=1 [L]

so if somebody enters /health-safety it will redirect to course-list.php?id=1

I have other rules going on, so it needs to detect if it's for health-safety.


If they will be entering www.yoursite.com/health-safety/, this rule should work:

RewriteRule ^health-safety/?$ course-list.php?id=1 [L]

If there will be an additional path, you may need this rule:

RewriteRule ^health-safety/([^/\.]+)/?$ course-list.php?id=$1 [L]

In the second example www.yoursite.com/health-safety/5 would display www.yoursite.com/course-list.php?id=5

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜