【发布时间】:2016-12-04 19:38:21
【问题描述】:
我知道这是一个奇怪的问题,但我不知道为什么我的页面在使用 hxxp://url[dot]tld/file.php 访问它时没有加载“.php”文件的原因。要查看内容,我必须通过 hxxp://url[dot]tld/file.php/ 访问它。我知道我可以从 cpanel(重定向 - 部分)执行此操作,但我的提供商有一个自定义面板,我发现无处重定向选项。我尝试了一些来自互联网的代码,通过 .htaccess 将旧网址重定向到新网址,但我重定向到 hxxp://url[dot]tld/file.php///////////// // 或类似的东西。
编辑:.htaccess 内容现在
RewriteEngine on
RewriteCond %{HTTP_HOST} ^online\.my\-domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.online\.my\-domain\.com$
RewriteRule ^/?$ "http\:\/\/google\.com\/" [R=302,L]
//Rewrite to www
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^online.my-domain.com[nc]
RewriteRule ^(.*)$ http://www.online.my-domain.com/$1 [r=301,nc]
Redirect 301 /php-file-with-problems.php /php-file-with-problems.php/
我怎么说我被重定向到 online.my-domain.com/php-file-with-problems.php////////////
【问题讨论】:
-
请更新问题以显示您的 .htaccess 文件中的相关内容。
-
谢谢,我刚刚上传了!
-
请看看这是否回答了您的问题:stackoverflow.com/questions/7780859/…
-
它工作但根本没有,当我访问带有至少 1 个斜线的 url 时它的工作,但是当我访问没有斜线的 url.tld/file.php 时,我遇到了同样的问题。我会再等一会儿,然后回来回答。不酷的是,当我访问 url.tld/file.php/ 时,我被重定向到带有许多斜杠的 url ////////// 就像在第一篇文章中一样。