如何使用apache更改php页面的URL

如何使用apache更改php页面的URL,php,apache,Php,Apache,例如,我想这样做: 原始URL:domain.com/folder/index.php?i=something 更改的URL:domain.com/folder/something 但保留原始URL的内容,使用apache的重写规则。有人能告诉我一个很好的教程或如何使用它的文档吗?打开httph.conf fine:LoadModule rewrite\u module modules/mod\u rewrite.so,然后取消选中 # Open The RewriteEngine Rewri

例如,我想这样做:

原始URL:domain.com/folder/index.php?i=something

更改的URL:domain.com/folder/something


但保留原始URL的内容,使用apache的重写规则。有人能告诉我一个很好的教程或如何使用它的文档吗?

打开httph.conf fine:LoadModule rewrite\u module modules/mod\u rewrite.so,然后取消选中
# Open The RewriteEngine 
RewriteEngine On

RewriteBase /

# Rewrite 

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^bbs/test-([0-9]+)\.html$ bbs/test.php?id=$1&%1

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^jingdian-([0-9]+)\.html$ jingdian.php?id=$1&%1
LoadModule rewrite_module modules/mod_rewrite.so 创建.htaccess文件

RewriteEngine on
RewriteRule ^folder/([a-zA-Z0-9_-]+)/([0-9]+).html$ index.php?id=$2

RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule (.*) /folder/$1
配置错误 ErrorDocument Error\u代码/Error.html
示例:ErrorDocument 404/error_404.html

你应该去看看这篇文章:你的答案完全错了