Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我怎样才能摆脱这个“问题”;。html";在我的网页的url中?_Html_Url - Fatal编程技术网

我怎样才能摆脱这个“问题”;。html";在我的网页的url中?

我怎样才能摆脱这个“问题”;。html";在我的网页的url中?,html,url,Html,Url,例如,在我的联系人页面上,url显示为:websitename/contact.html。如果可能,我想将网站路径更改为websitename/contact。您需要将其添加到.htaccess文件中 #mode_rerwrite start here RewriteEngine On # does not apply to existing directores, meaning that if the folder exists on server then don

例如,在我的联系人页面上,url显示为:websitename/contact.html。如果可能,我想将网站路径更改为websitename/contact。

您需要将其添加到.htaccess文件中

    #mode_rerwrite start here
    RewriteEngine On 
    # does not apply to existing directores, meaning that if the folder exists on server then don't change anything and don't run the rule.
    RewriteCond %{REQUEST_FILENAME} !-d 
    #Check for file in directory with .html extension 
    RewriteCond %{REQUEST_FILENAME} !-f 
    #Here we actually show the page that has .html extension
    RewriteRule ^([^\.]+)$ $1.html [NC, L] 

我不是很擅长解释,但是我添加了关于这些行的注释。谢谢你的更新!至于你的解释能力,这是你在实践中会学到的;而且,老实说:你在这里的解释虽然简短,但并不能真正支持你的说法,即你不擅长这些:)什么.htaccess文件?问题中没有任何内容表明OP正在使用支持htaccess的HTTP服务器。这取决于您使用的HTTP服务器。