问题描述
大家好,我需要帮助阿帕奇模式改写因为我是新手。其实我不知道该怎么做这件事。
Hello everyone I need help for apache mode rewrite cause I'm novice and. Actually I don't know how to make this done.
下面是角问题
我有一些网址,我想与Apache进行编辑
I have some urls that I want to edit them with apache
1 mywebsite / category.php --->我想该URL留喜欢它
mywebsite / category.php?SID =类别名称--->
mywebsite /分类/ categoryname.html
1- mywebsite/category.php ---> I want that url to stay like it is mywebsite/category.php?sid=categoryname ---> mywebsite/category/categoryname.html
2 - mywebsite / news.php - >无修改
mywebsite / news.php?视图= 1(2,3,4,5- ....在数据库等标识)--->
mywebsite /新闻/话题了header.html
话题标题是新闻的标题将从数据库通过ID叫做
2- mywebsite/news.php --> No modification mywebsite/news.php?view=1(2,3,4,5....etc id in the database) ---> mywebsite/news/topic header.htmltopic header is the title of the news that will be called from the database via the id
以及感谢大家的帮助,你真的原因我不知道如何做到这一点。
所有我能做的就是创建一个htaccess文件^^。
Well Thanks everyone for you help cause really I don't know how to do this.All what I can do is create a htaccess file ^^.
推荐答案
在你的的.htaccess
文件中写:
RewriteEngine On
RewriteRule ^/category.php?sid=([^&]+) /category/$1.html [L,R]
这篇关于阿帕奇重写URL需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!