简体   繁体   English

为什么页面显示内容时浏览到site.com/file.php/

[英]Why page showing content when browse to site.com/file.php/

I got notifications from Google webmaster tool that I have duplicated page titles. 我收到了Google网站管理员工具的通知,我有重复的网页标题。 It was properly to browse mysite.com/file.php but I do not know why mysite.com/file.php/ is showing some of content by file.php. 浏览mysite.com/file.php是正确的,但我不知道为什么mysite.com/file.php/会通过file.php显示一些内容。 Please advise how to remove/disable content showing when browse mysite.com/file.php/ 请告知如何删除/禁用浏览时显示的内容mysite.com/file.php/

1st: You might have a filename file.php and directory file.php . 1st:你可能有一个文件名file.php 目录file.php Check those out. 看看那些。

2nd: You might have .htaccess rewrite rule, that messes stuff up, if you do check out the syntax on that. 第二:你可能有.htaccess重写规则,如果你确实检查了语法,那就搞砸了。

When you hit /file.php , or /file.php/ what changes is pathname that the browser "sees". 当您点击/file.php/file.php/ ,浏览器“看到”的路径名会发生什么变化。 In first case, it is / , in second case it's /file.php . 在第一种情况下,它是/ ,在第二种情况下是/file.php

Hence, when you use relative path (to images, stylesheets, etc), in second case the browser will send requests to wrong URIs. 因此,当您使用相对路径(对图像,样式表等)时,在第二种情况下,浏览器将向错误的URI发送请求。

To avoid that, use <base url="http://example.com/path/to/site/root/"> in your HTML 为避免这种情况,请在HTML中使用<base url="http://example.com/path/to/site/root/">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 .htaccess将url.com/file.php?=$terms重定向到newurl.com/search.php?= $ terms(如果引荐来源网址不是site.com) - .htaccess redirect url.com/file.php?=$terms to newurl.com/search.php?=$terms if referrer is not site.com 当我将我的浏览器指向网站site.com/index.php/&quot;non-existent-dir“时显示index.php没有css的页面 - When i point my browser to website site.com/index.php/“non-existent-dir” shows index.php the page with no css 像site.com/#/xyz一样,PHP / CodeIgniter是否可以读取URL? - Any way for PHP/CodeIgniter to read the URL, when it's like site.com/#/xyz …? Laravel 仅显示一个路由 site.com/admin 的空白页面,所有其他不存在的路由都转到 404 页面 - Laravel showing blank page for only one route site.com/admin, all other non existing route goes to 404 page 从PHP中传递的变量解析出“ site.com”? - Parsing out “site.com” from a passed variable in PHP? 有没有办法创建一个像 site.com/state/127 这样的友好 url 并且仍然指向一个特定的文件,比如 index.php - Is there a way to create a friendly url like site.com/state/127 and still point to a particular file like index.php 标记<a onclick = file.php>和刷新页面</a> - tag <a onclick = file.php> and refresh page mod_rewrite指向site.com/something到index.php?values = something - mod_rewrite to direct site.com/something to index.php?values=something 系统(&#39;php file.php&#39;); 不起作用,为什么? - system('php file.php'); doesn't work, why? `require(&#39;file.php&#39;)`停止我的代码并显示空白页 - `require ('file.php')` stops my code and display blank page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM