当我加载我的网站时,显示的第一页是www.website.com/index.html.这就是你在广告栏中看到的。当我打开网站上的第二个页面时,会显示www.website.com/page1.html。
现在如何将www.website.com/index.html更改为www.website.com/,将其他页面改为www.website.com/page1而不是www.website.com/page1.html
发布于 2015-01-06 18:45:51
试试这个方法
<script type='text/javascript'>
if(history.replaceState) history.replaceState({}, "", "/");
</script> 注:你想要显示的路径在哪里.
或
您必须将此添加到.htaccess文件中。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php它显示像mysite.com一样的url,不管我点击了哪个链接。但是我在重新加载页面时遇到了问题,这个完整的url带有查询字符串,闪烁到地址栏中。
https://stackoverflow.com/questions/27804941
复制相似问题