如何.html从静态页面的URL中删除?
此外,我需要将任何网址重定向到没有网址的网址.html.(即www.example.com/page.html到www.example.com/page).
我知道如何进行URL的重写,例如:
www.example.com/index.php?id=1&cat=3to www.example.com/1/3/(或者其他).我知道.
我不知道的是如何在所有页面中更改我的整个链接以链接到漂亮的URL.我所有网站的链接都是旧时尚(<a href="index.php?id=1&cat=2">),还有很多.
如果用户点击index.php?id = 1,我问是否有人有想法或知道如何自动重定向到那个漂亮的URL.(如果你在网址中更改标题,几乎就像这个网站Stackoverflow).
所以我的预算是......
使用.htaccess读取index.php?id = 1&cat = 2来重写索引/ 1/3本身再次解释(奇怪)
一个php文件,用于重定向htaccess重写为原始的...
结论:<a href="index.php?id=1&.....">自动更改为index/1/2
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
##################################
# This turns index.php?id=1&cat=2 into index/1/2 and then back 'transparent' into index.php?id=1&cat=2 if you have old fashioned
# links in your site and don't want to change them :)
# Avoid mod_rewrite infinite loops
# This is critical if you want to use this code
RewriteCond %{ENV:REDIRECT_STATUS} …Run Code Online (Sandbox Code Playgroud)