【发布时间】:2021-08-07 15:56:24
【问题描述】:
所有链接都在本地主机而不是服务器上正确重定向。
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^css/(.*\\.css) /combine.php?type=css&files=$1
RewriteRule ^js/(.*\\.js) /combine.php?type=javascript&files=$1
ErrorDocument 404 /module/error.php
RewriteRule ^/?app/([^/\.]+)/$ /index.php?pl=$1 [L,QSA]
RewriteRule ^/?app/([^/\.]+)$ /index.php?pl=$1 [L,QSA]
RewriteRule ^/?app/([^/\.]+)/([^/\.]+)/$ /index.php?pl=$1&type=$2 [L,QSA]
RewriteRule ^/?app/([^/\.]+)/([^/\.]+)$ /index.php?pl=$1&type=$2 [L,QSA]
RewriteRule ^/?print/([^/\.]+)/$ /index.php?pl=$1 [L,QSA]
RewriteRule ^/?print/([^/\.]+)$ /index.php?pl=$1 [L,QSA]
RewriteRule ^/?print/([^/\.]+)/([^/\.]+)/$ /index.php?pl=$1&type=$2 [L,QSA]
RewriteRule ^/?print/([^/\.]+)/([^/\.]+)$ /index.php?pl=$1&type=$2 [L,QSA]
RewriteRule ^/?report/([^/\.]+)/$ /module/report/index.php?pl=$1 [L,QSA]
RewriteRule ^/?report/([^/\.]+)$ /module/report/index.php?pl=$1 [L,QSA]
RewriteRule ^/?logout/$ /module/login/logout.php [L,QSA]
RewriteRule ^/?logout$ /module/login/logout.php [L,QSA]
RewriteRule ^/?login/$ /module/login/index.php?page=login [L,QSA]
RewriteRule ^/?login$ /module/login/index.php?page=login [L,QSA]
RewriteRule ^/?token/$ /module/token/index.php [L,QSA]
RewriteRule ^/?token$ /module/token/index.php [L,QSA]
RewriteRule ^/?sql/$ /class/adminer.php [L,QSA]
RewriteRule ^/?sql$ /class/adminer.php [L,QSA]
RewriteRule ^/?update/$ /module/update.php [L,QSA]
RewriteRule ^/?update$ /module/update.php [L,QSA]
RewriteRule ^/?backup$ /module/backup/index.php [L,QSA]
RewriteRule ^/?db_backup$ /module/backup/db_backup.php [L,QSA]
上面的代码在本地主机上正确重定向。在服务器上,它适用于某些链接,而不适用于所有链接。例如,domain.com/app/estimate,它不起作用。对于 /app/items,它正在工作。请帮帮我...
在第一张图片中,重定向不起作用。 在第二张图片中,重定向工作正常
文件结构:
Root
|
|-->index.php
|
|-->class
| |
| |-->conf.php
| |
| |-->functions.php
|
|-->module
| |
| |-->reseller
| |
| |-->Estimate
| | |
| | |-->estimate.php
functions.php 内容:
function value_show($text, $name, $value, $type,$count) {
if($type=="checked")
{
return '$(\'input[name="'.$name.'"]
[value="'.$value.'"]\').prop(\'checked\',true);';
}
if($type=="array")
{
return
'$(\''.$text.'[name="'.$name.'"]\').eq('.$count.').val("'.$value.'");';
}
if($type=="multiple")
{
return '$("'.$text.'[name=\''.$name.'\']").val(['.$value.']);';
}
return '$(\''.$text.'[name='.$name.']\').val("'.$value.'");';
}
我已经在 conf.php 中导入了functions.php,它具有在 index.php 中导入的连接字符串,如下所示
conf.php:
require("functions.php");
index.php
require("class/conf.php");
当我从estimate.php调用functions.php中的函数时, 它给出了加载页面。如果我删除该函数调用,那么它会显示estimate.php 的内容。
【问题讨论】:
-
您尝试过什么解决问题的方法?你被困在哪里了? “它不工作”是什么意思?这和 PHP 有什么关系?
-
实际上我是 php 新手。我有点困惑。它在 localhost 上重定向 url。以及为什么它在服务器上不起作用。我将此项目添加为子域。它仅显示加载程序。它不显示页面内容。