【发布时间】:2015-07-24 09:22:22
【问题描述】:
我有 3 个关于 .htaccess 的问题,
1- 如果我使用 .htaccess 重写我网站上的 url,它是否会影响任何请求,或者我是否需要更改所有表单的链接,例如,如果表单的操作帖子是 index.php?submit我需要更改该链接吗?例如,当我在 .htaccess 中隐藏 .php 扩展名或者它不影响它时
2-我如何基本上隐藏所有 .php 扩展名
3- 如果我有以下网址
www.link.com/post.php?post_id=53&post_name=the-International-day-in-roma
a-)我如何让 .htaccess 将其重写为以下内容
www.link.com/post/the-International-day-in-roma
b-)如果有逗号有关系吗?或者我也可以删除它们吗?
www.link.com/post.php?post_id=53&post_name=everyday,-or-today,-or-tomorrow
【问题讨论】:
-
每个线程一个问题
-
你能回答我的第三个吗@anubhava
-
抱歉,第 3 个要求很困难,因为 postId
53不在原始 URLwww.link.com/post/the-International-day-in-roma中,因此无法重写为www.link.com/post.php?post_id=53&post_name=the-International-day-in-roma -
那我需要做什么?删除 post_id=.. 然后我就可以重写了?如果是的话怎么办? @anubhava
-
post_id将需要在post.php中进行查找。你可以有漂亮的 URL:www.link.com/post/53/the-International-day-in-roma
标签: php apache .htaccess mod-rewrite url-rewriting