开发者

htaccess advice - how do I write this rule?

开发者_运维百科I'm not going to lie. I suck at writing htaccess rules. I'm ok with regexes though.

Ok, basically, user enters url: www.site.com/page.id or www.site.com/folder/page.id

That should be internally written to: www.site.com/index.php?page=id

I've got the stuff sorted in the index.php, but I just can't seem to hack it with the htaccess.

What do you suggest it should be?

EDIT: business/legal/service-level-agreement.10 and services.5 would need to work, so the rule would need to get the digit after the dot, period.


Try this rule:

RewriteRule ^([^/]+/)?([^/]+)\.(\d+)$ index.php?$2=$3


The simplest way would be:

RewriteEngine On
RewriteRule ^([^/]*)$ index.php?page=$1 [L]

Take a look here maybe this can help:

generateit

cooletips

webmaster-toolkit

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜