Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/375.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.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
Javascript 当你访问你网站上的某个页面时,它没有.html,你会怎么做呢_Javascript_Php_Html - Fatal编程技术网

Javascript 当你访问你网站上的某个页面时,它没有.html,你会怎么做呢

Javascript 当你访问你网站上的某个页面时,它没有.html,你会怎么做呢,javascript,php,html,Javascript,Php,Html,当你访问一个没有.html或.php的url时。使用html或javascript我将如何做到这一点?我的网站是,当我进入一个像“没事”这样的页面时,它会显示http://artsicleprojects.com/nothing.php。 所以基本上,我想做的就是让它这么说 http://artsicleprojects.com/nothing当您转到页面时 谢谢 好的,那么您需要使用nothing.html/nothing.php文件,将名称更改为index.html或index.php,然后

当你访问一个没有.html或.php的url时。使用html或javascript我将如何做到这一点?我的网站是,当我进入一个像“没事”这样的页面时,它会显示
http://artsicleprojects.com/nothing.php
。 所以基本上,我想做的就是让它这么说

http://artsicleprojects.com/nothing
当您转到页面时


谢谢

好的,那么您需要使用
nothing.html
/
nothing.php
文件,将名称更改为
index.html
index.php
,然后创建一个名为“nothing”的文件夹,并将索引文件放在那里。然后转到www.example.com/nothing,
index.html
/
index.php
将自动运行,而不显示在URL中



这有帮助吗?如果是,请接受我的回答。:)

使用htacess重写url。或者,这通常是通过正确配置Web服务器来实现的。例如,Apache可以使用
RewriteRule
在后台附加扩展,或者使用
AddType
通过PHP处理非类型化(或显式命名)文件。类似的问题将在上讨论。谢谢@Anat!这对我有很大帮助!看看这个-。此外,您还可以将php文件放在同名文件夹中,并将该文件重命名为index.php,这是一个简单的修复方法。例如,
somePath/notes.php
somePath/notes/index.php
”,或者如果你想证明的话,你可以自己点击:)它只适用于meI的主url artsicleprojects.com。请看你有
http://www.artsicleprojects.com/exittheroom/index.php
。只需删除/index.php,页面就会运行完全相同的内容。