Home  >  Article  >  Backend Development  >  php的url重写。mod_rewrite,该怎么解决

php的url重写。mod_rewrite,该怎么解决

WBOY
WBOYOriginal
2016-06-13 12:12:16931browse

php的url重写。mod_rewrite
LoadModule rewrite_module modules/mod_rewrite.so  打开这个就是url的重写,但是我在实际应用中应该怎么使用呢,能不能举一个简单的例子。ThinkPHP引入了一个文件是 .htaccess  

  Options +FollowSymlinks
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

希望可以给我一个简单的例子,谢谢了!
------解决思路----------------------
.htaccess里面

RewriteEngine on
RewriteBase /
Options -Indexes

RewriteRule ^product/([1-9]\d*).html($) product.php?id=$1
打开product/111.html就进入对应的product.php页页,接收参数id
------解决思路----------------------
#RewriteRule ([^/]*)_([^/]*).html$      Include/Action1.php?InTo=$1&OprType=$2 [NC]
按着这个方法写就对了,前面是文件,后面是具体的url
------解决思路----------------------
http://www.verydz.com/help/thread-674-1-1.html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn