我想重定向
这样的网页 www.example.com/example
要
www.example.com/page.php?page=example
实际上我是一个创建免费页面的网站。而不是像这样的长链接:
www.example.com/page.php?page=example
我希望它像这样短。
www.example.com/example
我只想重定向该链接。
我使用的脚本是由我的朋友制作的。
我不太了解hta。我们怎样才能用hta做到这一点?
答案 0 :(得分:0)
您可以在htaccess文件中使用此规则
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ /page.php?page=$1 [QSA,NC,L]
RewriteCond确保如果请求已经用于文件或目录,则会跳过重写规则