.htaccess无法在SSL Apache上运行 [英] .htaccess not working on SSL apache

查看:125
本文介绍了.htaccess无法在SSL Apache上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试修复此.htaccess,以便它可以在SSL apache服务器上工作。在将其托管在另一台Linux服务器(http://)上并且可以正常工作之前,但是当使用apache和SSL(https://)将文件上传到另一台Linux服务器时,它停止了工作。主要功能是隐藏.php扩展名...

Trying to fix this .htaccess, so it can work on a SSL apache server. Before it was hosted on another Linux server (http://) and was working without problems, but when uploading the files to another Linux server with apache and SSL (https://), it stopped working. The main function is to hide the .php extension...

这里是我正在使用的内容:

Here´s what I was using:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]

感谢您的帮助!

推荐答案

因此,可能不允许使用.htaccess文件,并且默认情况下,在许多系统上也不允许使用.htaccess文件。要查看是否允许.htaccess,请将其设置为.htaccess:

So, .htaccess files may not be allowed, and by default on many systems they are not allowed. To see if .htaccess is allowed, make this your .htaccess:

BREAK IT!

那应该是您的.htaccess中唯一的内容。尝试在您的网站上加载任何页面,并且如果启用了.htaccess用法,则会看到内部服务器错误或其他错误,但看不到实际页面。

That should be the only contents in your .htaccess. Attempt to load any page on your website, and if .htaccess usage is enabled, you would see "Internal Server Error" or possibly some other error, but you would not see your actual page.

如果您确实看到此错误,那实际上很好,并且意味着启用了.htaccess使用。如果没有看到错误,则可能是必须找到Apache .conf文件,并在内部查找该行:

If you do see the error, that's actually good and means .htaccess usage is enabled. If you don't see the error, it's likely that you will have to find your Apache .conf file and inside look for the line(s):

AllowOverride None

将其更改为:

AllowOverride All

如果在此之后您仍然无法使用.htaccess,则可能还有其他与Apache相关的文件具有 AllowOverride None。我想到的是您的虚拟主机文件,并且在我的系统上的/ etc / apache2 / sites-available /中。

If after doing that you still can't use .htaccess, then there may be other apache related files that have "AllowOverride None". On that comes to mind is your virtual host file, and on my system that is located at /etc/apache2/sites-available/.

如果仍然有问题,请检查以下内容:
https://docs.bolt.cm/3.3/howto/making-sure-htaccess-works

If you still have problems, check this out: https://docs.bolt.cm/3.3/howto/making-sure-htaccess-works

这篇关于.htaccess无法在SSL Apache上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆