我想要举例来说:
原始网址:domain.com/folder/index.php?i=something
更改了网址:domain.com/folder/something
但保留原始URL的内容,使用apache的RewriteRule。有人能告诉我一个好的教程或如何使用它的文档吗?
答案 0 :(得分:0)
打开httph.conf罚款:#LoadModule rewrite_module modules / mod_rewrite.so,然后取消选中# (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_code /error.html 示例:ErrorDocument 404 / error_404.html
答案 1 :(得分:-1)
# 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