首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为网站创建htaccess

为网站创建htaccess
EN

Stack Overflow用户
提问于 2011-03-10 18:32:23
回答 2查看 221关注 0票数 0

这是什么?

转换:

http://name.com/pro/weblog/index.php?rayan_cat=23&rayan_cat_in=25

至:

http://name.com/pro/weblog/23/25/

如果为index.php,则时间未知

EN

回答 2

Stack Overflow用户

发布于 2011-03-10 18:33:54

这叫做URL重写。请参阅:http://httpd.apache.org/docs/current/mod/mod_rewrite.html

票数 1
EN

Stack Overflow用户

发布于 2011-03-10 18:35:31

代码语言:javascript
复制
RewriteEngine On
RewriteCond %{HTTP_HOST} ^http://Yoururl/
RewriteRule (.*) http://yoururl//$1 [R=301,L]


RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ index.php?rayan_cat=$1&rayan_cat_in=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/$ index.php?rayan_cat=$1&rayan_cat_in=$2

替换您的URL并将文件保存为根文件夹中的.htaccess

现在,您可以使用GET方法获取参数值。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5258399

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档