开发者

Shortening URLS

Basically i want to do this,

www.mydomain.com/index.html >> change to >> www.mydomain.com/

and checkout for example,

www.mydomain.com/cart.php >> change to >> www.mydomain.com/cart/

www.mydomain.com/checkout.php >开发者_运维技巧> change to >> www.mydomain.com/checkout/

Would i do this in .htaccess? i have no idea.

Any help would be greatly appreciated.


Use mod_rewrite to do this.

There are some examples on this page. :)


RewriteEngine On
RewriteRule   ^cart/([0-9]+)   cart.php?ID=$1 [L]

This will allow www.mydomain.com/cart/ to run cart.php with any numerical id after the slash to the appended as an id.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜