一种方法是将所有内容重写为处理脚本
RewriteEngine onRewritebase /# only rewrite if the requested file doesn't existRewriteCond %{REQUEST_FILENAME} !-s# pass the rest of the request into index.php to handle RewriteRule ^(.*)$ /index.php/ [L]
因此,如果您有请求http:// yourserver / foo / bar /
您实际上得到的是对http://yourserver/index.php/foo/bar的请求-
您可以离开index.php来决定如何处理/ foo / bar(使用$ _SERVER [‘PATH_INFO’]-
tom)
您只需要在第一次修改.htaccess。以后所有对不存在文件的请求都可以用PHP处理。
您可能还会发现mod_rewrite的文档很有用-
但保持简单或准备浪费大量的睡眠和头发来查找晦涩的错误。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)