开发者

How to rewrite folder access to a specific file?

开发者 https://www.devze.com 2023-03-06 10:34 出处:网络
I\'m trying to setup the following rule: RewriteRule ^(?=health-safety/.*)([^/\\.]+)/开发者_开发技巧?$ course-list.php?id=1 [L]

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

精彩评论

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