我已将文件扩展名,HTML更改为PHP。当我在localhost中浏览时,它会被重定向到主服务器。我正在使用github,文件是使用带有twitter bootstrap的HTML5boilerplate开发的。我已经使用扩展HTML在github中提交了几个。
即
我之前的网址:[localhost]/sovolve.com/new/index.html
当前网址:[localhost]/sovolve.com/new/index.php
当我使用当前网址浏览localhost时,它会被重定向到http://sovolve.com/new/index.html
如果需要更新代码,请告诉我。
答案 0 :(得分:0)
index.php和index.html页面是否存在于同一文档根目录中?
如果存在apache优先使用index.html而不是index.php。
请删除index.html。它会解决你的问题。
您使用的是.htaccess吗?详细说明。
如果是,请使用以下代码
Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1index.php [R=301,L]