我有一个页面,让我们说
http://www.mypage.com/pageone.html
我正在使用javascript重定向它,如下所示
window.location.replace(" http://www.facebook.com/pageone&#34);
但要重定向页面需要键入" .html"我怎么能省略" .html" http://www.mypage.com/pageone.html
之后的延伸简短我的预期链接是:http://www.mypage.com/pageone
答案 0 :(得分:0)
尝试理解它对我有用的一个小例子:
RewriteEngine on
RewriteBase /
RewriteCond %{http://www.techdefeat.com/index.html} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://www.techdefeat.com/$1 [R=301,L]
以上示例将替换为: http://www.techdefeat.com/index.html : http://www.techdefeat.com/index