【问题标题】:I am not able to figure out a bug that is when I try to click on a link on my website it appears the 404我无法找出一个错误,即当我尝试单击我网站上的链接时,它会出现 404
【发布时间】:2017-11-09 16:49:27
【问题描述】:

我的网站使用 PHP 编码并托管在 Hostinger 中。问题是当我想转到另一个链接时,例如联系部分或关于部分,它会出现 404 Not Found Page。但是,我在本地服务器上尝试了相同的文件,它工作正常。问题出在代码还是主机提供商。

我的网站链接:http://tranvio.com

.htaccess:

RewriteEngine on
RewriteBase /public_html
RewriteRule ^details-(.*)?$ index.php?a=details&id=$1 [L]
RewriteRule ^recovery-(.*)?$ index.php?a=recovery&hash=$1 [L]
RewriteRule ^refid=(.*)?$ index.php?refid=$1 [L]

【问题讨论】:

  • 您在项目中使用过.htaccess 文件吗?如果是,请向我们展示您的重定向链接代码。
  • 权限相关问题。
  • 我已经创建了 .htaccess 并添加了一些东西,我将更新问题并添加 .htaccess 的代码
  • 是因为未指定RewriteBase /base
  • @FahadKazmi 那么我应该在那里指定什么?

标签: php web hosting web-hosting


【解决方案1】:
RewriteEngine On
RewriteRule ^testimonials?$ TESTIMONIAL_FILE_PATH_HERE [L]

如果您的 .htaccess 文件不存在,请将其放入您的根目录文件夹中。

【讨论】:

  • 这是我放的RewriteEngine On RewriteBase /tranvio RewriteRule ^/?$ tranvio / [L] RewriteRule ^testimonials?$ sources/testimonials.php [L]
  • 在您在第二条规则中发表评论时,写入您的主页文件完整路径来处理您的 php 文件。你的第一条规则也一样。
  • 好的,以 RewriteEngine On RewriteBase /http://tranvio.com/index.php RewriteRule ^/?$ http://tranvio.com/index.php/ [L] RewriteRule ^testimonials?$ sources/testimonials.php [L] 的方式输入它可以工作,但现在如果你进入推荐部分,它会显示 Bad Request
  • 也尝试删除 RewriteBase 和 firstrule。希望它有效。
  • 新错误Fatal error: Call to undefined function checkSession() in /home/u140593186/public_html/sources/testimonials.php on line 9
【解决方案2】:

问题已解决:

编辑 .htaccess 到这个:

RewriteEngine on
RewriteBase /
RewriteRule ^(login|register|forgot-
password|testimonials|logout|submit-testimonial)?$ index.php?a=$1 [L]
RewriteRule ^page/(contact|about|faq|privacy-policy|terms-of-service)?$ 
index.php?a=page&b=$1 [L] RewriteRule ^account/(exchanges|wallet|wallet_exchange|deposit|referrals|settings|with
drawals|withdrawal)?$ index.php?a=account&b=$1 [L]
RewriteRule ^account/exchanges/(.*)?$ index.php?
a=account&b=exchanges&page=$1 [L]
RewriteRule ^account/exchange/(.*)?$ index.php?
a=account&b=exchange&id=$1 [L]
RewriteRule ^account/referrals/(.*)?$ index.php?
a=account&b=referrals&page=$1 [L]
RewriteRule ^ref/(.*)?$ index.php?refid=$1 [L]
RewriteRule ^password-recovery/(.*)?$ index.php?a=password-
recovery&hash=$1 [L]
RewriteRule ^become_payment/(.*)?$ index.php?a=become_payment&id=$1 [L]`

【讨论】:

    猜你喜欢
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 2021-03-19
    • 1970-01-01
    • 2021-08-09
    • 2019-09-23
    • 1970-01-01
    • 2018-06-07
    相关资源
    最近更新 更多