改写规则改变网址 [英] rewrite rule for changing url

查看:183
本文介绍了改写规则改变网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是更改URL重写规则,如果一个用户类型

 的http://本地主机/网站/冷
 

然后,它应改为

 的http://localhost/website/save.php ID =凉爽
 

解决方案

抱歉,无法格式化code在commet。这是回答这个问题:

  

您可以告诉我什么是的RewriteCond

事情是这样的:

  RewriteEngine叙述上
的RewriteCond%{REQUEST_URI}!/save.php
重写规则^(。*)$ save.php?ID = $ 1
 

如果URI不具有/save.php在它,那么它就会重写

What is the rewrite rule for changing the url if an user types

http://localhost/website/cool

Then it should be changed to

http://localhost/website/save.php?id=cool

解决方案

Sorry, can't format code in a commet. This is to answer the question:

May you please tell me what is RewriteCond

Something like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !/save.php
RewriteRule ^(.*)$ save.php?id=$1

If the URI doesn't have /save.php in it, then it will rewrite.

这篇关于改写规则改变网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆