php - Apache2 网站在整个站点中导航时不会更改默认 URL

标签 php mysql apache2 phpbb

美好的一天

我最近在 Linux 上使用典型的 LAMP 系统设置了我的新网络服务器。我使用 PhPBB 作为我网站的基础。

一切都是在线的,并且可以从网络外部访问。

唯一的问题:www.gaymerscommunity.com 的 URL 永远不会改变。您可以浏览整个测试论坛、注册部分或网站的任何其他部分,它将始终保持相同的 URL,没有/index/forums/register 或任何其他内容。始终只是基本 URL。

我使用 a2enmod 启用了重写,并且允许覆盖 apache2.conf 中目录中的所有内容;我还提前更改了/etc/hosts 文件以包含“127.0.0.1 gaymerscommunity.com”。

其他一切都几乎是默认的。

我真的希望论坛上的每个帖子都有一个唯一的网址,或者至少每个论坛都有一个我可以用来引导人们找到适当内容的网址。

我应该从哪里开始?

我的文件夹根目录中确实有一个 .htaccess 文件,但我从某人那里得到了它,说这是他们的 PhPBB 默认 .htaccess 文件。所以,我只是将其复制并启用重写。

<IfModule mod_rewrite.c>
RewriteEngine on

#
# Uncomment the statement below if you want to make use of
# HTTP authentication and it does not already work.
# This could be required if you are for example using PHP via Apache CGI.
#
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

#
# The following 3 lines will rewrite URLs passed through the front controller
# to not require app.php in the actual URL. In other words, a controller is
# by default accessed at /app.php/my/controller, but can also be accessed at
# /my/controller
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]

#
# If symbolic links are not already being followed,
# uncomment the line below.
# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/
#
#Options +FollowSymLinks
</IfModule>
<IfModule mod_version.c>
<IfVersion < 2.4>
    <Files "config.php">
        Order Allow,Deny
        Deny from All
    </Files>
    <Files "common.php">
        Order Allow,Deny
        Deny from All
    </Files>
</IfVersion>
<IfVersion >= 2.4>
    <Files "config.php">
        Require all denied
    </Files>
    <Files "common.php">
        Require all denied
    </Files>
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
<IfModule !mod_authz_core.c>
    <Files "config.php">
        Order Allow,Deny
        Deny from All
    </Files>
    <Files "common.php">
        Order Allow,Deny
        Deny from All
    </Files>
</IfModule>
<IfModule mod_authz_core.c>
    <Files "config.php">
        Require all denied
    </Files>
    <Files "common.php">
        Require all denied
    </Files>
</IfModule>
</IfModule>

最佳答案

已修复

事实证明,这与我自己的服务器设置无关,至少与我的服务器端无关。我单击网站上的链接并选择“在新选项卡中打开”。看哪,有一个新的 URL 地址。唯一的问题...它被列为 http:///forums。

所以,我去了我的域名提供商。我最近联系了他们,询问他们如何设置这一切,他们将域配置为转发到我的公共(public) IP 地址。事实证明这是错误的。

请勿将您的域名转发到公共(public) IP 地址。相反,请使用名称“@”编辑您的 DNS“A 类”列表,以指向您的公共(public) IP 地址。

你知道的越多=)

关于php - Apache2 网站在整个站点中导航时不会更改默认 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43568298/

相关文章:

mysql - 将 mysqldump 自动化到本地 Windows 计算机

MySQL #1064 : declare a variable

linux - 如何更改 apache 配置文件的默认路径?

python - 为什么 Apache 不使用 Django 和 mod_wsgi 显示 404 错误?

tomcat - Office 2007 MIME 类型的问题,它们在 IE 所有其他浏览器中下载为 *.zip 正常

php - PHP 中的 CSS 与 mysql

php - Silverstripe 单元测试修改实时数据库(postgres 模块)

python - 安装脚本退出并出现错误 : Unable to find vcvarsall. bat

php - 为什么 .env 文件优先于 .yaml 文件作为环境变量?

javascript - Select2.js 错误 : Cannot read property 'length' of undefined